From f46576168a1f5e5a54fa8d1cb6e9ab8a5aa66059 Mon Sep 17 00:00:00 2001 From: pictuga Date: Mon, 10 Nov 2014 23:14:54 +0100 Subject: [PATCH] Add :mono to disable multithreading Convenient to have linear logging --- README.md | 1 + morss/morss.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 55b91e9..8df85b1 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/morss/morss.py b/morss/morss.py index fd32511..f108a98 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -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()