From f94bc4545e08cd529167764f32548436bca97ede Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 16 Nov 2013 16:02:35 +0100 Subject: [PATCH] Add "LIM_TIME" to drop elements based on time Also this value and the similars, all take -1 as unlimited value --- morss.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/morss.py b/morss.py index bf7107b..0b9a5f6 100644 --- a/morss.py +++ b/morss.py @@ -28,6 +28,7 @@ from StringIO import StringIO from readability import readability LIM_ITEM = 100 # deletes what's beyond +LIM_TIME = 7 # deletes what's after MAX_ITEM = 50 # cache-only beyond MAX_TIME = 7 # cache-only after (in sec) DELAY = 10*60 # xml cache & ETag cache (in sec) @@ -506,10 +507,11 @@ def Gather(url, cachePath, options): print '%s/%s' % (i+1, min(MAX_ITEM, size)) sys.stdout.flush() - if i+1 > LIM_ITEM > 0: + if time.time() - startTime > LIM_TIME >= 0 or i+1 > LIM_ITEM >= 0: + log('dropped') item.remove() continue - elif time.time() - startTime > MAX_TIME >= 0 or i+1 > MAX_ITEM > 0: + elif time.time() - startTime > MAX_TIME >= 0 or i+1 > MAX_ITEM >= 0: if not options.proxy: if Fill(item, cache, url, True) is False: item.remove()