Skip to content

Commit

Permalink
Fix: lock updater - return correct bool value
Browse files Browse the repository at this point in the history
The function which extend lock duration in DB returns incorrect bool
value (return default false value). This cause that context is canceled
when extending lock duration and whole update process fails.

This commit fixes the bug and return correct bool value.
  • Loading branch information
Allda committed Apr 9, 2019
1 parent 3316e7e commit 4e49aaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions database/dbutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func AcquireLock(datastore Datastore, name, owner string, duration time.Duration

// ExtendLock extends the duration of an existing global lock for the given
// duration.
func ExtendLock(ds Datastore, name, whoami string, desiredLockDuration time.Duration) (extended bool, expiration time.Time) {
func ExtendLock(ds Datastore, name, whoami string, desiredLockDuration time.Duration) (bool, time.Time) {
tx, err := ds.Begin()
if err != nil {
return false, time.Time{}
Expand All @@ -374,7 +374,7 @@ func ExtendLock(ds Datastore, name, whoami string, desiredLockDuration time.Dura

if locked {
if err := tx.Commit(); err == nil {
return
return locked, expiration
}
}

Expand Down

0 comments on commit 4e49aaf

Please sign in to comment.