summaryrefslogtreecommitdiff
path: root/Mailman/queue/retry.py
diff options
context:
space:
mode:
authorBarry Warsaw2007-09-29 14:55:25 -0400
committerBarry Warsaw2007-09-29 14:55:25 -0400
commit3e9ed398b6a05c69daca14c8226ca7f57c164c21 (patch)
treeb0ae2e9771a80f9e0e6218871bbe2d281120202c /Mailman/queue/retry.py
parentcbf2967239163e42cc2b25eece7bb5cb71b197fe (diff)
downloadmailman-3e9ed398b6a05c69daca14c8226ca7f57c164c21.tar.gz
mailman-3e9ed398b6a05c69daca14c8226ca7f57c164c21.tar.zst
mailman-3e9ed398b6a05c69daca14c8226ca7f57c164c21.zip
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.
Diffstat (limited to 'Mailman/queue/retry.py')
-rw-r--r--Mailman/queue/retry.py40
1 files changed, 40 insertions, 0 deletions
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))