summaryrefslogtreecommitdiff
path: root/scripts/post
diff options
context:
space:
mode:
authorbwarsaw2000-06-14 05:19:13 +0000
committerbwarsaw2000-06-14 05:19:13 +0000
commit5b1f96b64525f5b6f0653b528b7e8be804555500 (patch)
tree1ceb89bb4c54b59da30c8f24f83cb1076ee7721a /scripts/post
parent2fbcaf2d5ad3cec301d97be59f430a77999e0753 (diff)
downloadmailman-5b1f96b64525f5b6f0653b528b7e8be804555500.tar.gz
mailman-5b1f96b64525f5b6f0653b528b7e8be804555500.tar.zst
mailman-5b1f96b64525f5b6f0653b528b7e8be804555500.zip
All three scripts have now been changed to always quickly queue their
messages to the qfiles directory. This once and for all avoids the possibility that we hit the MTA's command time limit. The mailing list objects are never locked so we can't time out there. They don't need to be locked for message queuing. The penalty is that we do more disk i/o for every message destined to the list, the list-owner or list-request, and messages are not delivered immediately. Both are probably worthy tradeoffs for absolutely guaranteeing that messages never get lost.
Diffstat (limited to 'scripts/post')
-rwxr-xr-xscripts/post32
1 files changed, 13 insertions, 19 deletions
diff --git a/scripts/post b/scripts/post
index b9720f03e..d9464ff69 100755
--- a/scripts/post
+++ b/scripts/post
@@ -18,8 +18,11 @@
"""Accept posts to a list and handle them properly.
-This script is invoked via the mail wrapper. stdin is the mail message, and
-argv[1] is the name of the target mailing list.
+The main advertised address for a list should be filtered to this program,
+through the mail wrapper. E.g. for list `test@yourdomain.com', the `test'
+alias would deliver to this script.
+
+Stdin is the mail message, and argv[1] is the name of the target mailing list.
"""
@@ -27,13 +30,10 @@ import sys
import paths
from Mailman import mm_cfg
-from Mailman import Utils
from Mailman import MailList
from Mailman import Message
from Mailman import Errors
-from Mailman import LockFile
from Mailman.Logging.Utils import LogStdErr
-from Mailman.Handlers import HandlerAPI
from Mailman.pythonlib.StringIO import StringIO
LogStdErr("error", "post")
@@ -79,20 +79,14 @@ def main():
# object in a usable form. From here on out, we should never lose
# messages.
msg = get_message(mlist)
- # Try to obtain the mailing list lock. If that fails, enqueue the message
- # for delivery by the qrunner cron job.
- try:
- mlist.Lock(timeout=mm_cfg.LIST_LOCK_TIMEOUT)
- except LockFile.TimeOutError:
- msg.Enqueue(mlist)
- return
- try:
- msgdata = {}
- # ignore return value
- HandlerAPI.DeliverToList(mlist, msg, msgdata)
- finally:
- mlist.Save()
- mlist.Unlock()
+ # Immediately queue the message for the qrunner to deliver, mostly likely
+ # about a minute from now. The advantage to this approach is that
+ # messages should never get lost -- some MTAs have a hard limit to the
+ # time a filter prog can run. Postfix is a good example; if the limit is
+ # hit, the proc is SIGKILL'd giving us no chance to save the message. It
+ # could take a long time to acquire the lock. This way we're fairly safe
+ # against catastrophe at the expense of more disk I/O.
+ msg.Enqueue(mlist)