repository: wait max 1 minutes for lock removal if context is canceled

The toplevel context in restic only canceled if the user interrupts a
restic operation. If the network connection has failed this can require
waiting the full retry duration of 15 minutes which is a bad user
experience for interactive usage. Thus limit the delay to one minute in
this case.
This commit is contained in:
Michael Eischer committed 2024-05-24 20:24:02 +02:00
1 parent 98709a4372
commit b1266867d2
3 files changed
+51 -20

No files matched your search

+1 -1
View File
@@ -132,7 +132,7 @@ func (l *locker) refreshLocks(ctx context.Context, backend backend.Backend, lock
// remove the lock from the repo
debug.Log("unlocking repository with lock %v", lock)
if err := lock.Unlock(); err != nil {
if err := lock.Unlock(ctx); err != nil {
debug.Log("error while unlocking: %v", err)
logger("error while unlocking: %v", err)
}