chiark / gitweb /
Limit yoweb-scrape backlog parsing to 500K
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 16 Jan 2010 15:30:30 +0000 (15:30 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Sat, 16 Jan 2010 18:53:10 +0000 (18:53 +0000)
yoweb-scrape

index e3a7c8c..10cc734 100755 (executable)
@@ -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