diff options
| author | bwarsaw | 2002-07-25 05:47:48 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-07-25 05:47:48 +0000 |
| commit | 0228d9c2c09c7b235a6e1482133b99c1a2ce28f6 (patch) | |
| tree | cc38913656c57843642c2c269bb17e18f7619ee4 /Mailman/Queue | |
| parent | 559514bbdcd48297e2e0fa543f6ef62212aad0ad (diff) | |
| download | mailman-0228d9c2c09c7b235a6e1482133b99c1a2ce28f6.tar.gz mailman-0228d9c2c09c7b235a6e1482133b99c1a2ce28f6.tar.zst mailman-0228d9c2c09c7b235a6e1482133b99c1a2ce28f6.zip | |
_dispose(): Two fixes, related to Daniel Buchmann's report about SF
bug # 571634. First, catch any ValueError coming from the mktime_tz()
call to calculate wildely out of date Date: headers. If we get the
ValueError it's likely because the year is insane <wink> and the Date:
should be clobbered.
The second fix narrows the region where the list gets locked to just
the .ArchiveMail() and .Save() calls. No wonder Daniel was getting
AlreadyLockedErrors here -- this was clearly broken.
Diffstat (limited to 'Mailman/Queue')
| -rw-r--r-- | Mailman/Queue/ArchRunner.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Mailman/Queue/ArchRunner.py b/Mailman/Queue/ArchRunner.py index 4384c3995..140973326 100644 --- a/Mailman/Queue/ArchRunner.py +++ b/Mailman/Queue/ArchRunner.py @@ -29,12 +29,6 @@ class ArchRunner(Runner): QDIR = mm_cfg.ARCHQUEUE_DIR def _dispose(self, mlist, msg, msgdata): - # Now try to get the list lock - try: - mlist.Lock(timeout=mm_cfg.LIST_LOCK_TIMEOUT) - except LockFile.TimeOutError: - # oh well, try again later - return 1 # Support clobber_date, i.e. setting the date in the archive to the # received date, not the (potentially bogus) Date: header of the # original message. @@ -49,10 +43,17 @@ class ArchRunner(Runner): # what's the timestamp on the original message? tup = parsedate_tz(originaldate) now = time.time() - if not tup: - clobber = 1 - elif abs(now - mktime_tz(tup)) > \ - mm_cfg.ARCHIVER_ALLOWABLE_SANE_DATE_SKEW: + try: + if not tup: + clobber = 1 + elif abs(now - mktime_tz(tup)) > \ + mm_cfg.ARCHIVER_ALLOWABLE_SANE_DATE_SKEW: + clobber = 1 + except ValueError: + # The likely cause of this is that the year in the Date: field + # is horribly incorrect, e.g. (from SF bug # 571634): + # Date: Tue, 18 Jun 0102 05:12:09 +0500 + # Obviously clobber such dates. clobber = 1 if clobber: del msg['date'] @@ -62,11 +63,14 @@ class ArchRunner(Runner): msg['X-Original-Date'] = originaldate # Always put an indication of when we received the message. msg['X-List-Received-Date'] = receivedtime - # - # runner specific code + # Now try to get the list lock + try: + mlist.Lock(timeout=mm_cfg.LIST_LOCK_TIMEOUT) + except LockFile.TimeOutError: + # oh well, try again later + return 1 try: mlist.ArchiveMail(msg) mlist.Save() finally: mlist.Unlock() - return 0 |
