When creating a dotlock, register it slightly earlier for cleanup
This closes a very unlikely window where we could create a dotlock file, but then encounter an error and fail to clean up the dotlock.
This commit is contained in:
parent
2b7baaf294
commit
4fb833176e
|
@ -398,11 +398,11 @@ class LockableMboxMixin:
|
||||||
raise LockUnavailable("Dotlock for '%s' unavailable" % self.mbox_file_name)
|
raise LockUnavailable("Dotlock for '%s' unavailable" % self.mbox_file_name)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
_stale.dotlock_files.append(lock_name)
|
||||||
finally:
|
finally:
|
||||||
os.close(plfd)
|
os.close(plfd)
|
||||||
os.unlink(prelock_name)
|
os.unlink(prelock_name)
|
||||||
vprint("acquired lockfile '%s'" % lock_name)
|
vprint("acquired lockfile '%s'" % lock_name)
|
||||||
_stale.dotlock_files.append(lock_name)
|
|
||||||
|
|
||||||
def _dotlock_unlock(self):
|
def _dotlock_unlock(self):
|
||||||
"""Delete the dotlock file for the 'mbox' mailbox."""
|
"""Delete the dotlock file for the 'mbox' mailbox."""
|
||||||
|
|
Loading…
Reference in New Issue