Skip to content
Snippets Groups Projects
Commit 279c831a authored by Stuart Gathman's avatar Stuart Gathman
Browse files

Purge old entries in auto_whitelist and send_dsn logs.

parent c0aa632e
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,9 @@
# CBV results.
#
# $Log$
# Revision 1.4 2007/01/11 04:31:26 customdesigned
# Negative feedback for bad headers. Purge cache logs on startup.
#
# Revision 1.3 2007/01/08 23:20:54 customdesigned
# Get user feedback.
#
......@@ -45,6 +48,7 @@ class AddrCache(object):
now = time.time()
lock = PLock(self.fname)
wfp = lock.lock()
changed = False
try:
too_old = now - age*24*60*60 # max age in days
for ln in open(self.fname):
......@@ -52,12 +56,17 @@ class AddrCache(object):
rcpt,ts = ln.strip().split(None,1)
l = time.strptime(ts,AddrCache.time_format)
t = time.mktime(l)
if t < too_old: continue
if t < too_old:
changed = True
continue
cache[rcpt.lower()] = (t,None)
except:
cache[ln.strip().lower()] = (now,None)
wfp.write(ln)
if changed:
lock.commit(self.fname+'.old')
else:
lock.unlock()
except IOError:
lock.unlock()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment