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 - `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 - `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 - `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 - `theforce`: force download the rss feed
- `silent`: don't output the final RSS (useless on its own, but can be nice when debugging) - `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) - `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 lim_time = LIM_TIME
max_item = MAX_ITEM max_item = MAX_ITEM
max_time = MAX_TIME max_time = MAX_TIME
threads = THREADS
if options.cache: if options.cache:
max_time = 0 max_time = 0
if options.mono:
threads = 1
# set # set
def runner(queue): def runner(queue):
while True: while True:
@ -646,7 +650,7 @@ def Gather(rss, url, cache, options):
queue = Queue.Queue() queue = Queue.Queue()
for i in xrange(THREADS): for i in xrange(threads):
t = threading.Thread(target=runner, args=(queue,)) t = threading.Thread(target=runner, args=(queue,))
t.daemon = True t.daemon = True
t.start() t.start()