Skip to content

Commit 56b31aa

Browse files
committed
update
1 parent 225e997 commit 56b31aa

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

Mailman/Queue/IncomingRunner.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,12 @@ def _oneloop(self):
414414
msgdata['whichq'] = self.QDIR
415415
# Shunt the message
416416
self._shunt.enqueue(msg, msgdata)
417+
# Remove the original file
418+
try:
419+
os.unlink(pckfile)
420+
mailman_log('debug', 'IncomingRunner._oneloop: Removed original file %s', pckfile)
421+
except OSError as e:
422+
mailman_log('error', 'IncomingRunner._oneloop: Failed to remove original file %s: %s', pckfile, str(e))
417423
continue
418424

419425
# Try to get message-id early for logging purposes
@@ -431,6 +437,12 @@ def _oneloop(self):
431437
mailman_log('error', 'IncomingRunner._oneloop: Unknown list %s for message %s (file: %s)',
432438
listname, msgid, filebase)
433439
self._shunt.enqueue(msg, msgdata)
440+
# Remove the original file
441+
try:
442+
os.unlink(pckfile)
443+
mailman_log('debug', 'IncomingRunner._oneloop: Removed original file %s', pckfile)
444+
except OSError as e:
445+
mailman_log('error', 'IncomingRunner._oneloop: Failed to remove original file %s: %s', pckfile, str(e))
434446
continue
435447

436448
# Process the message
@@ -461,16 +473,34 @@ def _oneloop(self):
461473
mailman_log('debug', ' - List: %s', mlist.internal_name())
462474
mailman_log('debug', ' - Message type: %s', msgdata.get('_msgtype', 'unknown'))
463475

476+
# Requeue the message and remove the original file
464477
self._switchboard.enqueue(msg, msgdata)
478+
try:
479+
os.unlink(pckfile)
480+
mailman_log('debug', 'IncomingRunner._oneloop: Removed original file %s', pckfile)
481+
except OSError as e:
482+
mailman_log('error', 'IncomingRunner._oneloop: Failed to remove original file %s: %s', pckfile, str(e))
465483
else:
466484
mailman_log('info', 'IncomingRunner._oneloop: Message processing complete, moving to shunt queue %s (msgid: %s)',
467485
filebase, msgid)
486+
# Move to shunt queue and remove the original file
487+
self._shunt.enqueue(msg, msgdata)
488+
try:
489+
os.unlink(pckfile)
490+
mailman_log('debug', 'IncomingRunner._oneloop: Removed original file %s', pckfile)
491+
except OSError as e:
492+
mailman_log('error', 'IncomingRunner._oneloop: Failed to remove original file %s: %s', pckfile, str(e))
468493

469494
except Exception as e:
470495
mailman_log('error', 'IncomingRunner._oneloop: Error processing message %s (file: %s): %s\n%s',
471496
msgid, filebase, str(e), traceback.format_exc())
472-
# Move to shunt queue on error
497+
# Move to shunt queue on error and remove the original file
473498
self._shunt.enqueue(msg, msgdata)
499+
try:
500+
os.unlink(pckfile)
501+
mailman_log('debug', 'IncomingRunner._oneloop: Removed original file %s', pckfile)
502+
except OSError as e:
503+
mailman_log('error', 'IncomingRunner._oneloop: Failed to remove original file %s: %s', pckfile, str(e))
474504

475505
except Exception as e:
476506
mailman_log('error', 'IncomingRunner._oneloop: Error dequeuing file %s: %s\n%s',

0 commit comments

Comments
 (0)