diff options
| author | bwarsaw | 1998-12-22 04:26:33 +0000 |
|---|---|---|
| committer | bwarsaw | 1998-12-22 04:26:33 +0000 |
| commit | c54eb6feb37ce15dbe67038ca647f04745f0a651 (patch) | |
| tree | d310d83b4e3983760d118948a236315893a1f1eb /Mailman/OutgoingQueue.py | |
| parent | aef6c8b23cdb1f12bb8ff4e376a0243a0a0ce935 (diff) | |
| download | mailman-c54eb6feb37ce15dbe67038ca647f04745f0a651.tar.gz mailman-c54eb6feb37ce15dbe67038ca647f04745f0a651.tar.zst mailman-c54eb6feb37ce15dbe67038ca647f04745f0a651.zip | |
Removed import of smtplib, since it isn't used in this file. Other
coding, comments, etc. formatting nits.
Diffstat (limited to 'Mailman/OutgoingQueue.py')
| -rw-r--r-- | Mailman/OutgoingQueue.py | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/Mailman/OutgoingQueue.py b/Mailman/OutgoingQueue.py index fbec37e78..6435cfa56 100644 --- a/Mailman/OutgoingQueue.py +++ b/Mailman/OutgoingQueue.py @@ -65,22 +65,25 @@ MAX_ACTIVE = 7200 # 2 hours # an active state for too long and attempt a delivery # def processQueue(): - import flock, time, smtplib, Utils - lock_file = flock.FileLock(os.path.join(mm_cfg.LOCK_DIR, "mmqueue_run.lock")) + import flock + import time + import Utils + + lock_file = flock.FileLock( + os.path.join(mm_cfg.LOCK_DIR, "mmqueue_run.lock")) lock_file.lock() files = os.listdir(mm_cfg.DATA_DIR) for file in files: # - # does it look like a q entry? + # does it look like a queue entry? # if TEMPLATE != file[:len(TEMPLATE)]: continue full_fname = os.path.join(mm_cfg.DATA_DIR, file) # - # we need to stat the file if it still exists (atomically, we - # can't just use use os.path.exists then stat it. - # if it doesn't exist, it's been dequeued since we saw - # it in the directory listing + # we need to stat the file if it still exists (atomically, we can't + # just use use os.path.exists then stat it. if it doesn't exist, it's + # been dequeued since we saw it in the directory listing # try: st = os.stat(full_fname) @@ -90,17 +93,20 @@ def processQueue(): except ValueError: code = "" msg = str(rest) - if code == errno.ENOENT: # file does not exist, it's already been dequeued + if code == errno.ENOENT: + # file does not exist, it's already been dequeued continue else: raise os.error, rest # - # if the file is not a deferred q message, we check to - # see if the creation time was too long ago and process - # it anyway. If the creation time was recent, leave it - # alone as it's probably being delivered by another process anyway + # if the file is not a deferred queue message, we check to see if the + # creation time was too long ago and process it anyway. If the + # creation time was recent, leave it alone as it's probably being + # delivered by another process anyway # - if not isDeferred(full_fname, st) and st[stat.ST_CTIME] > (time.time() - MAX_ACTIVE): + if (not isDeferred(full_fname, st) and + st[stat.ST_CTIME] > (time.time() - MAX_ACTIVE)): + # then continue f = open(full_fname,"r") recip,sender,text = marshal.load(f) @@ -109,7 +115,6 @@ def processQueue(): lock_file.unlock() - # # this function is used by any process that # attempts to deliver a message for the first time |
