Add :mono to disable multithreading

Convenient to have linear logging
master
pictuga 2014-11-10 23:14:54 +01:00
parent 5dd262139d
commit f46576168a
2 changed files with 6 additions and 1 deletions

View File

@ -49,6 +49,7 @@ The arguments are:
- `hungry`: grab full-article even if it already looks long enough
- `cache`: only take articles from the cache (ie. don't grab new articles' content), so as to save time
- `debug`: to have some feedback from the script execution. Useful for debugging
- `mono`: disable multithreading while fetching, makes debugging easier
- `theforce`: force download the rss feed
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging)
- `smart`: try to show only new elements in feed, to make it lighter (based on 304 headers)

View File

@ -613,10 +613,14 @@ def Gather(rss, url, cache, options):
lim_time = LIM_TIME
max_item = MAX_ITEM
max_time = MAX_TIME
threads = THREADS
if options.cache:
max_time = 0
if options.mono:
threads = 1
# set
def runner(queue):
while True:
@ -646,7 +650,7 @@ def Gather(rss, url, cache, options):
queue = Queue.Queue()
for i in xrange(THREADS):
for i in xrange(threads):
t = threading.Thread(target=runner, args=(queue,))
t.daemon = True
t.start()