Merge pull request #3512 from MichaelEischer/cleaner-lock-refresh

Prevent lock refresh from leaving behind lots of stale locks
This commit is contained in:
Alexander Neumann
2022-03-21 11:10:37 +01:00
committed by GitHub
4 changed files with 22 additions and 10 deletions

View File

@@ -223,15 +223,11 @@ func (l *Lock) Refresh(ctx context.Context) error {
return err
}
err = l.repo.Backend().Remove(context.TODO(), Handle{Type: LockFile, Name: l.lockID.String()})
if err != nil {
return err
}
debug.Log("new lock ID %v", id)
oldLockID := l.lockID
l.lockID = &id
return nil
return l.repo.Backend().Remove(context.TODO(), Handle{Type: LockFile, Name: oldLockID.String()})
}
func (l Lock) String() string {