From 4d0bbc2b1b2633d4e4f6597d5577ae71e8e6568a Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Mon, 4 Mar 2002 18:45:12 +0000 Subject: __init__(), _dispose(): Move the import of the DELIVERY_MODULE and the extraction of the process() method into the constructor. I don't think it's too much of a burden to have to restart the OutgoingRunner if you want to change the DELIVERY_MODULE (and I suspect it won't change that much anyway). This also seems to help control memory growth in the OutgoingRunner. --- Mailman/Queue/OutgoingRunner.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Mailman/Queue') diff --git a/Mailman/Queue/OutgoingRunner.py b/Mailman/Queue/OutgoingRunner.py index 4bc1afa8b..05b1a4b32 100644 --- a/Mailman/Queue/OutgoingRunner.py +++ b/Mailman/Queue/OutgoingRunner.py @@ -46,18 +46,18 @@ class OutgoingRunner(Runner): # We never lock the lists, but we need to be sure that MailList # objects read from the cache are always fresh. self._freshen = 1 + # We look this function up only at startup time + modname = 'Mailman.Handlers.' + mm_cfg.DELIVERY_MODULE + mod = __import__(modname) + self._func = getattr(sys.modules[modname], 'process') def _dispose(self, mlist, msg, msgdata): # Fortunately, we do not need the list lock to do deliveries. However # this does mean that we aren't as responsive to changes in list # configuration, since we never reload the list configuration. - handler = mm_cfg.DELIVERY_MODULE - modname = 'Mailman.Handlers.' + handler - mod = __import__(modname) - func = getattr(sys.modules[modname], 'process') try: pid = os.getpid() - func(mlist, msg, msgdata) + self._func(mlist, msg, msgdata) # Failsafe -- a child may have leaked through. if pid <> os.getpid(): syslog('error', 'child process leaked thru: %s', modname) -- cgit v1.3.1