diff options
author | msapiro <> | 2006-07-09 03:42:41 +0000 |
---|---|---|
committer | msapiro <> | 2006-07-09 03:42:41 +0000 |
commit | 7f5a6591910a10c5ecdd79322e53dc47c6e7a9cd (patch) | |
tree | 8dbfba956897a7c1cc35440a598c08fde2a0715f /Mailman | |
parent | 4dc70bbcc0856b2a27d0d6c0a2def51433712e36 (diff) | |
download | mailman2-7f5a6591910a10c5ecdd79322e53dc47c6e7a9cd.tar.gz mailman2-7f5a6591910a10c5ecdd79322e53dc47c6e7a9cd.tar.xz mailman2-7f5a6591910a10c5ecdd79322e53dc47c6e7a9cd.zip |
- Switchboard.py - Closed very tiny holes at the upper ends of queue
slices that could result in unprocessable queue entries. Improved FIFO
processing when two queue entries have the same timestamp.
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Queue/Switchboard.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Mailman/Queue/Switchboard.py b/Mailman/Queue/Switchboard.py index 52c430b0..17046a8c 100644 --- a/Mailman/Queue/Switchboard.py +++ b/Mailman/Queue/Switchboard.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2004 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2006 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 @@ -12,7 +12,8 @@ # # 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. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Reading and writing message objects and message metadata. """ @@ -59,6 +60,9 @@ except NameError: # (when False). Pickles are more efficient because the message doesn't need # to be re-parsed every time it's unqueued, but pickles are not human readable. SAVE_MSGS_AS_PICKLES = True +# Small increment to add to time in case two entries have the same time. This +# prevents skipping one of two entries with the same time until the next pass. +DELTA = .0001 @@ -163,9 +167,13 @@ class Switchboard: filebase = os.path.splitext(f)[0] when, digest = filebase.split('+') # Throw out any files which don't match our bitrange. BAW: test - # performance and end-cases of this algorithm. - if lower is None or (lower <= long(digest, 16) < upper): - times[float(when)] = filebase + # performance and end-cases of this algorithm. MAS: both + # comparisons need to be <= to get complete range. + if lower is None or (lower <= long(digest, 16) <= upper): + key = float(when) + while times.has_key(key): + key += DELTA + times[key] = filebase # FIFO sort keys = times.keys() keys.sort() |