Skip to content

Commit 90c18b5

Browse files
author
Tim Vaillancourt
committed
only release the lock if it is defined, to avoid deleting another thread/procs lock
1 parent d51e9f2 commit 90c18b5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

MongoBackup/Common/Lock.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def acquire(self):
2424
raise Exception, "Could not acquire lock!", None
2525

2626
def release(self):
27-
logging.debug("Releasing exclusive lock on file: %s" % self.lock_file)
28-
self._lock.close()
29-
return os.remove(self.lock_file)
27+
if self._lock:
28+
logging.debug("Releasing exclusive lock on file: %s" % self.lock_file)
29+
self._lock.close()
30+
return os.remove(self.lock_file)

0 commit comments

Comments
 (0)