summaryrefslogtreecommitdiff
path: root/Mailman/Queue
diff options
context:
space:
mode:
authorBarry Warsaw2007-09-29 11:09:14 -0400
committerBarry Warsaw2007-09-29 11:09:14 -0400
commitcbf2967239163e42cc2b25eece7bb5cb71b197fe (patch)
treee8445a0af47c9c203107eea913f11dbc9229477b /Mailman/Queue
parent773980eb727b98c902b93894cafcd6bc7d22510d (diff)
downloadmailman-cbf2967239163e42cc2b25eece7bb5cb71b197fe.tar.gz
mailman-cbf2967239163e42cc2b25eece7bb5cb71b197fe.tar.zst
mailman-cbf2967239163e42cc2b25eece7bb5cb71b197fe.zip
qrunner, mailmanctl and various other repairs.
The convenience methods in Defaults for getting seconds, minutes, hours, and days now returns a subtype of timedelta, which provides conversion to float and int for compatibility with interfaces that require those values (e.g. signal.alarm() and time.sleep(). In bin/make_instance, the var_dir really needs to be an absolute path, otherwise it's possible to get a var dir nested inside the var dir. More MailList object eradication.
Diffstat (limited to 'Mailman/Queue')
-rw-r--r--Mailman/Queue/BounceRunner.py9
-rw-r--r--Mailman/Queue/RetryRunner.py2
-rw-r--r--Mailman/Queue/Runner.py4
3 files changed, 8 insertions, 7 deletions
diff --git a/Mailman/Queue/BounceRunner.py b/Mailman/Queue/BounceRunner.py
index d398e1b4a..6ce7ef393 100644
--- a/Mailman/Queue/BounceRunner.py
+++ b/Mailman/Queue/BounceRunner.py
@@ -19,9 +19,9 @@
import os
import re
-import time
import cPickle
import logging
+import datetime
from email.MIMEMessage import MIMEMessage
from email.MIMEText import MIMEText
@@ -81,10 +81,11 @@ class BounceMixin:
config.DATA_DIR, 'bounce-events-%05d.pck' % os.getpid())
self._bounce_events_fp = None
self._bouncecnt = 0
- self._nextaction = time.time() + config.REGISTER_BOUNCES_EVERY
+ self._nextaction = (datetime.datetime.now() +
+ config.REGISTER_BOUNCES_EVERY)
def _queue_bounces(self, listname, addrs, msg):
- today = time.localtime()[:3]
+ today = datetime.date.today()
if self._bounce_events_fp is None:
self._bounce_events_fp = open(self._bounce_events_file, 'a+b')
for addr in addrs:
@@ -129,7 +130,7 @@ class BounceMixin:
self._register_bounces()
def _doperiodic(self):
- now = time.time()
+ now = datetime.datetime.now()
if self._nextaction > now or self._bouncecnt == 0:
return
# Let's go ahead and register the bounces we've got stored up
diff --git a/Mailman/Queue/RetryRunner.py b/Mailman/Queue/RetryRunner.py
index 9ecde0419..33e9459b5 100644
--- a/Mailman/Queue/RetryRunner.py
+++ b/Mailman/Queue/RetryRunner.py
@@ -38,4 +38,4 @@ class RetryRunner(Runner):
def _snooze(self, filecnt):
# We always want to snooze
- time.sleep(self.SLEEPTIME)
+ time.sleep(float(self.SLEEPTIME))
diff --git a/Mailman/Queue/Runner.py b/Mailman/Queue/Runner.py
index 9fb5434cc..958e11e6c 100644
--- a/Mailman/Queue/Runner.py
+++ b/Mailman/Queue/Runner.py
@@ -229,9 +229,9 @@ class Runner:
based on this value. By default, we only snooze if there was nothing
to do last time around.
"""
- if filecnt or self.SLEEPTIME <= 0:
+ if filecnt or float(self.SLEEPTIME) <= 0:
return
- time.sleep(self.SLEEPTIME)
+ time.sleep(float(self.SLEEPTIME))
def _shortcircuit(self):
"""Return a true value if the individual file processing loop should