summaryrefslogtreecommitdiff
path: root/Mailman/queue
diff options
context:
space:
mode:
authorBarry Warsaw2008-02-25 00:24:03 -0500
committerBarry Warsaw2008-02-25 00:24:03 -0500
commit6965bd89216a8d759ff8ea35ca4d1e88b0c35906 (patch)
tree642089474463c2632ab358a8f6d982af19ed24ca /Mailman/queue
parentaab29f252ebefb1520714080a90bb42a25393f18 (diff)
downloadmailman-6965bd89216a8d759ff8ea35ca4d1e88b0c35906.tar.gz
mailman-6965bd89216a8d759ff8ea35ca4d1e88b0c35906.tar.zst
mailman-6965bd89216a8d759ff8ea35ca4d1e88b0c35906.zip
Rework the basic infrastructure for qrunner process control. Split out the
functionality of mailmanctl into a separate master watcher script. mailmanctl has not yet been updated but that'll happen next. Fix DELIVERY_MODULE to name a handler instead of a module. Change make_instance to use pkg_resources instead of module.__file__. Change the qrunner and master processes coordination so that the qrunners are not restarted on SIGINT, because otherwise C-c just doesn't work. Now SIGUSR1 is how we'll implement 'mailman restart'. Add a database commit so that initializing the schema doesn't lock the sqlite database. Also, don't try to initialize the schema if the tables already exist. Use some sqlite magic to do this test. Move mailman.cfg.in into a new package Mailman/extras inside the tree. Also, MAILMAN_UID and MAILMAN_GID should be integers not strings. Convert the command runner to use an IHandler instance instead of handler module. Similarly for the outgoing runner, DELIVERY_MODULE now names an IHandler instance instead of a handler module.
Diffstat (limited to 'Mailman/queue')
-rw-r--r--Mailman/queue/command.py4
-rw-r--r--Mailman/queue/outgoing.py17
-rw-r--r--Mailman/queue/pipeline.py4
3 files changed, 12 insertions, 13 deletions
diff --git a/Mailman/queue/command.py b/Mailman/queue/command.py
index 8217acad6..a0db2f776 100644
--- a/Mailman/queue/command.py
+++ b/Mailman/queue/command.py
@@ -33,7 +33,6 @@ from email.MIMEText import MIMEText
from Mailman import Message
from Mailman import Utils
-from Mailman.Handlers import Replybot
from Mailman.app.replybot import autorespond_to_sender
from Mailman.configuration import config
from Mailman.i18n import _
@@ -206,7 +205,8 @@ class CommandRunner(Runner):
return False
# Do replybot for commands
mlist.Load()
- Replybot.process(mlist, msg, msgdata)
+ replybot = config.handlers['replybot']
+ replybot.process(mlist, msg, msgdata)
if mlist.autorespond_requests == 1:
log.info('replied and discard')
# w/discard
diff --git a/Mailman/queue/outgoing.py b/Mailman/queue/outgoing.py
index 09572ba9b..a3d60f0a0 100644
--- a/Mailman/queue/outgoing.py
+++ b/Mailman/queue/outgoing.py
@@ -46,14 +46,13 @@ class OutgoingRunner(Runner, BounceMixin):
Runner.__init__(self, slice, numslices)
BounceMixin.__init__(self)
# We look this function up only at startup time
- modname = 'Mailman.Handlers.' + config.DELIVERY_MODULE
- mod = __import__(modname)
- self._func = getattr(sys.modules[modname], 'process')
+ handler = config.handlers[config.DELIVERY_MODULE]
+ self._func = handler.process
# This prevents smtp server connection problems from filling up the
# error log. It gets reset if the message was successfully sent, and
# set if there was a socket.error.
- self.__logged = False
- self.__retryq = Switchboard(config.RETRYQUEUE_DIR)
+ self._logged = False
+ self._retryq = Switchboard(config.RETRYQUEUE_DIR)
def _dispose(self, mlist, msg, msgdata):
# See if we should retry delivery of this message again.
@@ -69,7 +68,7 @@ class OutgoingRunner(Runner, BounceMixin):
if pid <> os.getpid():
log.error('child process leaked thru: %s', modname)
os._exit(1)
- self.__logged = False
+ self._logged = False
except socket.error:
# There was a problem connecting to the SMTP server. Log this
# once, but crank up our sleep time so we don't fill the error
@@ -78,10 +77,10 @@ class OutgoingRunner(Runner, BounceMixin):
if port == 0:
port = 'smtp'
# Log this just once.
- if not self.__logged:
+ if not self._logged:
log.error('Cannot connect to SMTP server %s on port %s',
config.SMTPHOST, port)
- self.__logged = True
+ self._logged = True
return True
except Errors.SomeRecipientsFailed, e:
# Handle local rejects of probe messages differently.
@@ -120,7 +119,7 @@ class OutgoingRunner(Runner, BounceMixin):
msgdata['last_recip_count'] = len(recips)
msgdata['deliver_until'] = deliver_until
msgdata['recips'] = recips
- self.__retryq.enqueue(msg, msgdata)
+ self._retryq.enqueue(msg, msgdata)
# We've successfully completed handling of this message
return False
diff --git a/Mailman/queue/pipeline.py b/Mailman/queue/pipeline.py
index 14bfea56c..47c2f9e6f 100644
--- a/Mailman/queue/pipeline.py
+++ b/Mailman/queue/pipeline.py
@@ -22,9 +22,9 @@ through the 'preparation pipeline'. This pipeline adds, deletes and modifies
headers, calculates message recipients, and more.
"""
-from Mailman.app.pipeline import process
+from Mailman.app.pipelines import process
from Mailman.configuration import config
-from Mailman.queue import runner
+from Mailman.queue import Runner