forked from TrueCloudLab/restic
Merge pull request #3134 from greatroar/unlock-warn
Warn when unlock fails instead of returning an error
This commit is contained in:
commit
7fda2f2ad8
2 changed files with 6 additions and 12 deletions
|
@ -48,12 +48,7 @@ func runCat(gopts GlobalOptions, args []string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
defer unlockRepo(lock)
|
||||||
err := unlockRepo(lock)
|
|
||||||
if err != nil {
|
|
||||||
Warnf("unlock repo failed: %v", err)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tpe := args[0]
|
tpe := args[0]
|
||||||
|
|
|
@ -85,9 +85,9 @@ func refreshLocks(wg *sync.WaitGroup, done <-chan struct{}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func unlockRepo(lock *restic.Lock) error {
|
func unlockRepo(lock *restic.Lock) {
|
||||||
if lock == nil {
|
if lock == nil {
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
globalLocks.Lock()
|
globalLocks.Lock()
|
||||||
|
@ -99,18 +99,17 @@ func unlockRepo(lock *restic.Lock) error {
|
||||||
debug.Log("unlocking repository with lock %v", lock)
|
debug.Log("unlocking repository with lock %v", lock)
|
||||||
if err := lock.Unlock(); err != nil {
|
if err := lock.Unlock(); err != nil {
|
||||||
debug.Log("error while unlocking: %v", err)
|
debug.Log("error while unlocking: %v", err)
|
||||||
return err
|
Warnf("error while unlocking: %v", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the lock from the list of locks
|
// remove the lock from the list of locks
|
||||||
globalLocks.locks = append(globalLocks.locks[:i], globalLocks.locks[i+1:]...)
|
globalLocks.locks = append(globalLocks.locks[:i], globalLocks.locks[i+1:]...)
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug.Log("unable to find lock %v in the global list of locks, ignoring", lock)
|
debug.Log("unable to find lock %v in the global list of locks, ignoring", lock)
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func unlockAll() error {
|
func unlockAll() error {
|
||||||
|
|
Loading…
Reference in a new issue