From 4243d9d8178176021e7bdc96d5dbb4f1358b62bb Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Wed, 7 Jul 1999 21:55:19 +0000 Subject: Move the locking stuff from here to cron/run_queue. This way, I can wrap the body of the code in a try/finally so the lock is definitely released should something bad happen. --- Mailman/OutgoingQueue.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'Mailman/OutgoingQueue.py') diff --git a/Mailman/OutgoingQueue.py b/Mailman/OutgoingQueue.py index b4ca0560e..6ad5cf5ba 100644 --- a/Mailman/OutgoingQueue.py +++ b/Mailman/OutgoingQueue.py @@ -38,6 +38,7 @@ import sys import os +import time import stat import marshal import errno @@ -69,24 +70,12 @@ QF_MODE = 0660 MAX_ACTIVE = 7200 # 2 hours - +# processQueue is called from cron/run_queue, which manages the lockfile # -# 1) get global lock so only of these -# procedures can run at a time -# 2) find all the files that are deferred queue -# entries and all the files that have been in -# an active state for too long and attempt a delivery +# find all the files that are deferred queue entries and all the files that +# have been in an active state for too long and attempt a delivery # def processQueue(): - import flock - import time - import Utils - - lock_file = flock.FileLock( - os.path.join(mm_cfg.LOCK_DIR, "mmqueue_run.lock"), - # running the queue can take a long time. - hung_timeout=14400) - lock_file.lock() files = os.listdir(mm_cfg.DATA_DIR) for file in files: # @@ -143,7 +132,6 @@ def processQueue(): l.write(' / %s' % v) l.write('\n') l.flush() - lock_file.unlock() # -- cgit v1.2.3-70-g09d2