@@ -619,46 +619,36 @@ def _cleanup(self):
619619 _doperiodic = BounceMixin ._doperiodic
620620
621621 def _oneloop (self ):
622- """Process one batch of messages from the outgoing queue."""
623- mailman_log ('debug' , 'OutgoingRunner: Starting one loop iteration' )
624- try :
625- # Get the list of files to process
626- files = self ._switchboard .files ()
627- if not files :
628- mailman_log ('debug' , 'OutgoingRunner: No files to process' )
629- return
630-
631- mailman_log ('debug' , 'OutgoingRunner: Processing %d files' , len (files ))
622+ """Process one batch of messages from the queue."""
623+ # Get all files in the queue
624+ files = self ._switchboard .files ()
625+ if not files :
626+ return 0
632627
633- # Process each file
634- for filebase in files :
635- try :
636- # Try to get the file from the switchboard
637- msg , msgdata = self ._switchboard .dequeue (filebase )
638- except Exception as e :
639- mailman_log ('error' , 'OutgoingRunner: Error dequeuing %s: %s' , filebase , str (e ))
640- mailman_log ('error' , 'OutgoingRunner: Traceback:\n %s' , traceback .format_exc ())
641- continue
642-
643- if msg is None :
644- mailman_log ('debug' , 'OutgoingRunner: No message data for %s' , filebase )
645- continue
628+ # Process each file
629+ for filebase in files :
630+ try :
631+ # Try to get the file from the switchboard
632+ msg , msgdata = self ._switchboard .dequeue (filebase )
633+ except Exception as e :
634+ mailman_log ('error' , 'OutgoingRunner: Error dequeuing %s: %s' , filebase , str (e ))
635+ mailman_log ('error' , 'OutgoingRunner: Traceback:\n %s' , traceback .format_exc ())
636+ continue
646637
647- try :
648- # Process the message
649- self ._dispose (msg , msgdata )
650- with self ._total_messages_lock :
651- self ._total_messages_processed += 1
652- mailman_log ('debug' , 'OutgoingRunner: Successfully processed message %s' , filebase )
653- except Exception as e :
654- mailman_log ('error' , 'OutgoingRunner: Error processing %s: %s' , filebase , str (e ))
655- mailman_log ('error' , 'OutgoingRunner: Traceback:\n %s' , traceback .format_exc ())
656- self ._handle_error (e , msg , None )
638+ if msg is None :
639+ mailman_log ('debug' , 'OutgoingRunner: No message data for %s' , filebase )
640+ continue
657641
658- except Exception as e :
659- mailman_log ('error' , 'OutgoingRunner: Error in _oneloop: %s' , str (e ))
660- mailman_log ('error' , 'OutgoingRunner: Traceback:\n %s' , traceback .format_exc ())
661- raise
642+ try :
643+ # Process the message
644+ self ._dispose (msg , msgdata )
645+ with self ._total_messages_lock :
646+ self ._total_messages_processed += 1
647+ mailman_log ('debug' , 'OutgoingRunner: Successfully processed message %s' , filebase )
648+ except Exception as e :
649+ mailman_log ('error' , 'OutgoingRunner: Error processing %s: %s' , filebase , str (e ))
650+ mailman_log ('error' , 'OutgoingRunner: Traceback:\n %s' , traceback .format_exc ())
651+ self ._handle_error (e , msg , None )
662652
663653 def _handle_error (self , exc , msg = None , mlist = None , preserve = True ):
664654 """Enhanced error handling with circuit breaker and detailed logging."""
0 commit comments