Update of /cvsroot/mailman/mailman/Mailman/Queue
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20088

Modified Files:
      Tag: Release_2_1-maint
        Runner.py 
Log Message:
_oneloop(): Switchboard.dequeue() can't really return Nones for msg or msgdata
any more (they were error signals in the previous switchboard implementation),
so simplify the loop.  We can't have 'lost data files'.


Index: Runner.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Queue/Runner.py,v
retrieving revision 2.25.2.2
retrieving revision 2.25.2.3
diff -u -d -r2.25.2.2 -r2.25.2.3
--- Runner.py   22 Feb 2004 22:38:16 -0000      2.25.2.2
+++ Runner.py   15 May 2004 21:48:45 -0000      2.25.2.3
@@ -31,6 +31,8 @@
 from Mailman.Queue.Switchboard import Switchboard
 from Mailman.Logging.Syslog import syslog
 
+import email.Errors
+
 try:
     True, False
 except NameError:
@@ -91,32 +93,34 @@
         # available for this qrunner to process.
         files = self._switchboard.files()
         for filebase in files:
-            # Ask the switchboard for the message and metadata objects
-            # associated with this filebase.
-            msg, msgdata = self._switchboard.dequeue(filebase)
-            # It's possible one or both files got lost.  If so, just ignore
-            # this filebase entry.  dequeue() will automatically unlink the
-            # other file, but we should log an error message for diagnostics.
-            if msg is None or msgdata is None:
-                syslog('error', 'lost data files for filebase: %s', filebase)
-            else:
-                # Now that we've dequeued the message, we want to be
-                # incredibly anal about making sure that no uncaught exception
-                # could cause us to lose the message.  All runners that
-                # implement _dispose() must guarantee that exceptions are
-                # caught and dealt with properly.  Still, there may be a bug
-                # in the infrastructure, and we do not want those to cause
-                # messages to be lost.  Any uncaught exceptions will cause the
-                # message to be stored in the shunt queue for human
+            try:
+                # Ask the switchboard for the message and metadata objects
+                # associated with this filebase.
+                msg, msgdata = self._switchboard.dequeue(filebase)
+            except email.Errors.MessageParseError, e:
+                # It's possible to get here if the message was stored in the
+                # pickle in plain text, and the metadata had a _parsemsg key
+                # that was true, /and/ if the message had some bogosity in
+                # it.  It's almost always going to be spam or bounced spam.
+                # There's not much we can do (and we didn't even get the
+                # metadata, so just log the exception and continue.
+                self._log(e)
+                syslog('error', 'Ignoring unparseable message: %s', filebase)
+                continue
+            try:
+                self._onefile(msg, msgdata)
+            except Exception, e:
+                # All runners that implement _dispose() must guarantee that
+                # exceptions are caught and dealt with properly.  Still, there
+                # may be a bug in the infrastructure, and we do not want those
+                # to cause messages to be lost.  Any uncaught exceptions will
+                # cause the message to be stored in the shunt queue for human
                 # intervention.
-                try:
-                    self._onefile(msg, msgdata)
-                except Exception, e:
-                    self._log(e)
-                    # Put a marker in the metadata for unshunting
-                    msgdata['whichq'] = self._switchboard.whichq()
-                    filebase = self._shunt.enqueue(msg, msgdata)
-                    syslog('error', 'SHUNTING: %s', filebase)
+                self._log(e)
+                # Put a marker in the metadata for unshunting
+                msgdata['whichq'] = self._switchboard.whichq()
+                filebase = self._shunt.enqueue(msg, msgdata)
+                syslog('error', 'SHUNTING: %s', filebase)
             # Other work we want to do each time through the loop
             Utils.reap(self._kids, once=True)
             self._doperiodic()


_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to