From 4e49aaf34647ab636595c1ba631efa0cea56ceac Mon Sep 17 00:00:00 2001 From: Ales Raszka Date: Tue, 9 Apr 2019 14:41:40 +0200 Subject: [PATCH] Fix: lock updater - return correct bool value 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. --- database/dbutil.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/dbutil.go b/database/dbutil.go index 94528266..c16a2ce8 100644 --- a/database/dbutil.go +++ b/database/dbutil.go @@ -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{} @@ -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 } }