From: Ian Jackson Date: Sat, 16 Jan 2010 15:30:30 +0000 (+0000) Subject: Limit yoweb-scrape backlog parsing to 500K X-Git-Tag: 6.5.0~4 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.main.git;a=commitdiff_plain;h=adafb5f3c892af2676009ce33f19819e6a13fd18 Limit yoweb-scrape backlog parsing to 500K --- diff --git a/yoweb-scrape b/yoweb-scrape index e3a7c8c..10cc734 100755 --- a/yoweb-scrape +++ b/yoweb-scrape @@ -502,9 +502,15 @@ class ChatLogTracker: # self._v = self._vl[self._vessel] self._date = None self._myself = myself_pi - self._f = file(logfn) self._lbuf = '' - self._progress = [0, os.fstat(self._f.fileno()).st_size] + self._f = file(logfn) + flen = os.fstat(self._f.fileno()).st_size + max_backlog = 500000 + if flen > max_backlog: + startpos = flen - max_backlog + self._f.seek(startpos) + self._f.readline() + self._progress = [0, flen - self._f.tell()] self._disembark_myself() self._need_redisplay = False self._lastvessel = None