From 3e9ed398b6a05c69daca14c8226ca7f57c164c21 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sat, 29 Sep 2007 14:55:25 -0400 Subject: Reorganize the qrunner infrastructure. First, the package has been renamed from Mailman.Queue to Mailman.queue (note the case change to be more PEP 8 compliant). The Switchboard and Runner classes have been moved into the package __init__.py and the previous class modules have been removed. The switchboard cache is removed; I don't think it was ultimately buying us much. Now, just import the Switchboard class and instantiate it directly. Added an IRunner interface. Renamed the ArchRunner to ArchiveRunner. bin/qrunner and bin/mailmanctl are updated accordingly. For the former, it no long accepts -r=All to run all qrunners. You can still use the short name (e.g. --runner=incoming) to run the built-in queue runners, but this design will eventually allow for plugin qrunners by allowing them to be run specifying the full package path to the class. It also now accepts a leading dot to indicate a qrunner class relative to the Mailman.queue package. --- Mailman/queue/retry.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Mailman/queue/retry.py (limited to 'Mailman/queue/retry.py') diff --git a/Mailman/queue/retry.py b/Mailman/queue/retry.py new file mode 100644 index 000000000..35accf262 --- /dev/null +++ b/Mailman/queue/retry.py @@ -0,0 +1,40 @@ +# Copyright (C) 2003-2007 by the Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +import time + +from Mailman.configuration import config +from Mailman.queue import Runner, Switchboard + + + +class RetryRunner(Runner): + QDIR = config.RETRYQUEUE_DIR + SLEEPTIME = config.minutes(15) + + def __init__(self, slice=None, numslices=1): + Runner.__init__(self, slice, numslices) + self.__outq = Switchboard(config.OUTQUEUE_DIR) + + def _dispose(self, mlist, msg, msgdata): + # Move it to the out queue for another retry + self.__outq.enqueue(msg, msgdata) + return False + + def _snooze(self, filecnt): + # We always want to snooze + time.sleep(float(self.SLEEPTIME)) -- cgit v1.2.3-70-g09d2