diff options
| author | toshio | 2012-03-14 05:26:40 +0000 |
|---|---|---|
| committer | toshio | 2012-03-14 05:26:40 +0000 |
| commit | ccde42a936f6c87032c7afd80f33ca5f3fa00b54 (patch) | |
| tree | 1181f3862c8f6d930e61ef56425aeb47f89a8b01 /src/mailman/archiving/prototype.py | |
| parent | 446cf202e419d532df5aaec4bebc2eca5178b5b5 (diff) | |
| download | mailman-ccde42a936f6c87032c7afd80f33ca5f3fa00b54.tar.gz mailman-ccde42a936f6c87032c7afd80f33ca5f3fa00b54.tar.zst mailman-ccde42a936f6c87032c7afd80f33ca5f3fa00b54.zip | |
Diffstat (limited to 'src/mailman/archiving/prototype.py')
| -rw-r--r-- | src/mailman/archiving/prototype.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/mailman/archiving/prototype.py b/src/mailman/archiving/prototype.py index 453ac3dba..266b1da07 100644 --- a/src/mailman/archiving/prototype.py +++ b/src/mailman/archiving/prototype.py @@ -102,17 +102,18 @@ class Prototype: # Lock the maildir as Maildir.add() is not threadsafe lock = Lock(os.path.join(config.LOCK_DIR, '%s-maildir.lock' % mlist.fqdn_listname)) - with lock: - try: - lock.lock(timeout=timedelta(seconds=1)) - # Add the message to the Maildir - # Message_key could be used to construct the file path if - # necessary:: - # os.path.join(archive_dir, mlist.fqdn_listname, 'new', - # message_key) - message_key = mail_box.add(message) - except TimeOutError: - # log the error and go on - elog.error('Unable to lock archive for %s, discarded' - ' message: %s' % (mlist.fqdn_listname, - message.get('message-id', '<unknown>'))) + try: + lock.lock(timeout=timedelta(seconds=1)) + # Add the message to the Maildir + # Message_key could be used to construct the file path if + # necessary:: + # os.path.join(archive_dir, mlist.fqdn_listname, 'new', + # message_key) + message_key = mail_box.add(message) + except TimeOutError: + # log the error and go on + elog.error('Unable to lock archive for %s, discarded' + ' message: %s' % (mlist.fqdn_listname, + message.get('message-id', '<unknown>'))) + finally: + lock.unlock(unconditionally=True) |
