@@ -30,6 +30,9 @@ class ArchRunner(Runner):
3030 QDIR = mm_cfg .ARCHQUEUE_DIR
3131
3232 def _dispose (self , mlist , msg , msgdata ):
33+ from Mailman import syslog
34+ syslog ('debug' , 'ArchRunner: Starting archive processing for list %s' , mlist .internal_name ())
35+
3336 # Support clobber_date, i.e. setting the date in the archive to the
3437 # received date, not the (potentially bogus) Date: header of the
3538 # original message.
@@ -44,26 +47,34 @@ def _dispose(self, mlist, msg, msgdata):
4447 originaldate = None
4548
4649 receivedtime = formatdate (msgdata ['received_time' ])
50+ syslog ('debug' , 'ArchRunner: Original date: %s, Received time: %s' , originaldate , receivedtime )
51+
4752 if not originaldate :
4853 clobber = 1
54+ syslog ('debug' , 'ArchRunner: No original date, will clobber' )
4955 elif mm_cfg .ARCHIVER_CLOBBER_DATE_POLICY == 1 :
5056 clobber = 1
57+ syslog ('debug' , 'ArchRunner: ARCHIVER_CLOBBER_DATE_POLICY = 1, will clobber' )
5158 elif mm_cfg .ARCHIVER_CLOBBER_DATE_POLICY == 2 :
5259 # what's the timestamp on the original message?
5360 try :
5461 tup = parsedate_tz (originaldate )
5562 now = time .time ()
5663 if not tup :
5764 clobber = 1
65+ syslog ('debug' , 'ArchRunner: Could not parse original date, will clobber' )
5866 elif abs (now - mktime_tz (tup )) > \
5967 mm_cfg .ARCHIVER_ALLOWABLE_SANE_DATE_SKEW :
6068 clobber = 1
69+ syslog ('debug' , 'ArchRunner: Date skew too large, will clobber' )
6170 except (ValueError , OverflowError , TypeError ):
6271 # The likely cause of this is that the year in the Date: field
6372 # is horribly incorrect, e.g. (from SF bug # 571634):
6473 # Date: Tue, 18 Jun 0102 05:12:09 +0500
6574 # Obviously clobber such dates.
6675 clobber = 1
76+ syslog ('debug' , 'ArchRunner: Date parsing exception, will clobber' )
77+
6778 if clobber :
6879 # Use proper header manipulation methods
6980 if 'date' in msg :
@@ -73,19 +84,33 @@ def _dispose(self, mlist, msg, msgdata):
7384 msg ['Date' ] = receivedtime
7485 if originaldate :
7586 msg ['X-Original-Date' ] = originaldate
87+ syslog ('debug' , 'ArchRunner: Clobbered date headers' )
88+
7689 # Always put an indication of when we received the message.
7790 msg ['X-List-Received-Date' ] = receivedtime
91+
7892 # Now try to get the list lock
93+ syslog ('debug' , 'ArchRunner: Attempting to lock list %s' , mlist .internal_name ())
7994 try :
8095 mlist .Lock (timeout = mm_cfg .LIST_LOCK_TIMEOUT )
96+ syslog ('debug' , 'ArchRunner: Successfully locked list %s' , mlist .internal_name ())
8197 except LockFile .TimeOutError :
8298 # oh well, try again later
99+ syslog ('debug' , 'ArchRunner: Failed to lock list %s, will retry later' , mlist .internal_name ())
83100 return 1
101+
84102 try :
85103 # Archiving should be done in the list's preferred language, not
86104 # the sender's language.
87105 i18n .set_language (mlist .preferred_language )
106+ syslog ('debug' , 'ArchRunner: Calling ArchiveMail for list %s' , mlist .internal_name ())
88107 mlist .ArchiveMail (msg )
108+ syslog ('debug' , 'ArchRunner: ArchiveMail completed, saving list %s' , mlist .internal_name ())
89109 mlist .Save ()
110+ syslog ('debug' , 'ArchRunner: Successfully completed archive processing for list %s' , mlist .internal_name ())
111+ except Exception as e :
112+ syslog ('error' , 'ArchRunner: Exception during archive processing for list %s: %s' , mlist .internal_name (), e )
113+ raise
90114 finally :
91115 mlist .Unlock ()
116+ syslog ('debug' , 'ArchRunner: Unlocked list %s' , mlist .internal_name ())
0 commit comments