Add "LIM_TIME" to drop elements based on time

Also this value and the similars, all take -1 as unlimited value
master
pictuga 2013-11-16 16:02:35 +01:00
parent 417609c1f0
commit f94bc4545e
1 changed files with 4 additions and 2 deletions

View File

@ -28,6 +28,7 @@ from StringIO import StringIO
from readability import readability from readability import readability
LIM_ITEM = 100 # deletes what's beyond LIM_ITEM = 100 # deletes what's beyond
LIM_TIME = 7 # deletes what's after
MAX_ITEM = 50 # cache-only beyond MAX_ITEM = 50 # cache-only beyond
MAX_TIME = 7 # cache-only after (in sec) MAX_TIME = 7 # cache-only after (in sec)
DELAY = 10*60 # xml cache & ETag cache (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)) print '%s/%s' % (i+1, min(MAX_ITEM, size))
sys.stdout.flush() 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() item.remove()
continue 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 not options.proxy:
if Fill(item, cache, url, True) is False: if Fill(item, cache, url, True) is False:
item.remove() item.remove()