mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-24 08:45:13 +00:00
fix Repository._active_txn state when lock upgrade fails
This commit is contained in:
parent
954b26f64c
commit
3b744d2ee8
1 changed files with 8 additions and 1 deletions
|
@ -138,7 +138,14 @@ def open_index(self, transaction_id):
|
|||
|
||||
def prepare_txn(self, transaction_id, do_cleanup=True):
|
||||
self._active_txn = True
|
||||
self.lock.upgrade()
|
||||
try:
|
||||
self.lock.upgrade()
|
||||
except UpgradableLock.WriteLockFailed:
|
||||
# if upgrading the lock to exclusive fails, we do not have an
|
||||
# active transaction. this is important for "serve" mode, where
|
||||
# the repository instance lives on - even if exceptions happened.
|
||||
self._active_txn = False
|
||||
raise
|
||||
if not self.index:
|
||||
self.index = self.open_index(transaction_id)
|
||||
if transaction_id is None:
|
||||
|
|
Loading…
Reference in a new issue