X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;ds=sidebyside;f=yoweb-scrape;h=e3a7c8c19c7b97f5e7c1e7dbb30f3418b101859a;hb=845ad7a414ac95feb6c64610cd846eecd50cf307;hp=31c75ae9f0a3ad774b1e2d3b5475f159933da6f8;hpb=3a24aecf857292701d755173ffdb91d10a3426c8;p=ypp-sc-tools.db-test.git diff --git a/yoweb-scrape b/yoweb-scrape index 31c75ae..e3a7c8c 100755 --- a/yoweb-scrape +++ b/yoweb-scrape @@ -43,6 +43,7 @@ import re as regexp import random import curses import termios +import random from optparse import OptionParser from StringIO import StringIO @@ -142,12 +143,14 @@ class Fetcher: min_age = 1 need_wait = 0 for age in ages: - if age < min_age and age < 300: + if age < min_age and age <= 5: debug('Fetcher morewait min=%d age=%d' % (min_age, age)) need_wait = max(need_wait, min_age - age) min_age += 3 min_age *= 1.25 + if need_wait > 0: + need_wait += random.random() - 0.5 return need_wait def _rate_limit_cache_clean(self, now): @@ -476,7 +479,7 @@ class PirateAboard: return pa.pi debug('PirateAboard refresh %d > %d %s' % ( age, guide, pa.name)) - imaginary = [2,6] + imaginary = [2,4] else: imaginary = [1] wait = fetcher.need_wait(now, imaginary) @@ -971,7 +974,7 @@ def do_track_chat_log(args, bu): track.catchup() if track.changed(): print track - sleep(1) + sleep(0.5 + 0.5 * random.random()) #----- ship management aid -----