Skip to content

Commit

Permalink
fix dealing with remote repo LockTimeout
Browse files Browse the repository at this point in the history
previously, this was handled in RPCError handler and always resulted in rc 2.

now re-raise LockTimeout locally, so it gives rc 2 (legacy) or 73 (modern).
  • Loading branch information
ThomasWaldmann committed Nov 13, 2023
1 parent e7b4564 commit 728a881
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/borg/archiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -5314,7 +5314,7 @@ def main(): # pragma: no cover
tb = f"{traceback.format_exc()}\n{sysinfo()}"
exit_code = e.exit_code
except RemoteRepository.RPCError as e:
important = e.exception_class not in ('LockTimeout', ) and e.traceback
important = e.traceback
msgid = e.exception_class
tb_log_level = logging.ERROR if important else logging.DEBUG
if important:
Expand Down
6 changes: 6 additions & 0 deletions src/borg/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .helpers import format_file_size
from .helpers import safe_unlink
from .helpers import prepare_subprocess_env, ignore_sigint
from .locking import LockTimeout
from .logger import create_logger, setup_logging
from .helpers import msgpack
from .repository import Repository
Expand Down Expand Up @@ -779,6 +780,11 @@ def handle_error(unpacked):
raise InvalidRPCMethod('(not available)')
else:
raise InvalidRPCMethod(args[0].decode())
elif error == 'LockTimeout':
if old_server:
raise LockTimeout('(not available)')
else:
raise LockTimeout(args[0].decode())
else:
raise self.RPCError(unpacked)

Expand Down

0 comments on commit 728a881

Please sign in to comment.