Skip to content

Commit c4c03dc

Browse files
committed
update
1 parent e9293cf commit c4c03dc

2 files changed

Lines changed: 44 additions & 2 deletions

File tree

Mailman/Queue/CommandRunner.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,35 @@ def _oneloop(self):
445445
if msg is None:
446446
continue
447447

448+
# Get the list name from msgdata
449+
listname = msgdata.get('listname')
450+
if not listname:
451+
syslog('error', 'CommandRunner._oneloop: No listname in message data for file %s', filebase)
452+
self._shunt.enqueue(msg, msgdata)
453+
continue
454+
455+
# Open the list
456+
try:
457+
mlist = MailList.MailList(listname, lock=False)
458+
except Errors.MMUnknownListError:
459+
syslog('error', 'CommandRunner._oneloop: Unknown list %s for message %s (file: %s)',
460+
listname, msg.get('message-id', 'n/a'), filebase)
461+
self._shunt.enqueue(msg, msgdata)
462+
continue
463+
448464
# Validate message
449465
msg, success = self._validate_message(msg, msgdata)
450466
if not success:
451467
syslog('error', 'CommandRunner._oneloop: Message validation failed for %s', filebase)
452468
continue
453469

454470
# Process message
455-
self._dispose(msg.mlist, msg, msgdata)
471+
try:
472+
self._dispose(mlist, msg, msgdata)
473+
except Exception as e:
474+
syslog('error', 'CommandRunner._oneloop: Error processing message %s: %s',
475+
msg.get('message-id', 'n/a'), str(e))
476+
self._shunt.enqueue(msg, msgdata)
456477
except Exception as e:
457478
syslog('error', 'CommandRunner._oneloop: Error processing file %s: %s', filebase, str(e))
458479
except Exception as e:

Mailman/Queue/OutgoingRunner.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,29 @@ def _oneloop(self):
558558
if msg is None:
559559
continue
560560

561+
# Get the list name from msgdata
562+
listname = msgdata.get('listname')
563+
if not listname:
564+
mailman_log('error', 'OutgoingRunner._oneloop: No listname in message data for file %s', filebase)
565+
self._shunt.enqueue(msg, msgdata)
566+
continue
567+
568+
# Open the list
569+
try:
570+
mlist = get_mail_list()(listname, lock=False)
571+
except Errors.MMUnknownListError:
572+
mailman_log('error', 'OutgoingRunner._oneloop: Unknown list %s for message %s (file: %s)',
573+
listname, msg.get('message-id', 'n/a'), filebase)
574+
self._shunt.enqueue(msg, msgdata)
575+
continue
576+
561577
# Process the message
562-
self._dispose(msg.list, msg, msgdata)
578+
try:
579+
self._dispose(mlist, msg, msgdata)
580+
except Exception as e:
581+
mailman_log('error', 'OutgoingRunner._oneloop: Error processing message %s: %s\nTraceback:\n%s',
582+
msg.get('message-id', 'n/a'), str(e), traceback.format_exc())
583+
self._shunt.enqueue(msg, msgdata)
563584
except Exception as e:
564585
mailman_log('error', 'OutgoingRunner._oneloop: Error processing file %s: %s', filebase, str(e))
565586
mailman_log('error', 'OutgoingRunner._oneloop: Traceback: %s', traceback.format_exc())

0 commit comments

Comments
 (0)