From e5ba988f014d991ef80db97056be9b3694763227 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Tue, 11 Jul 2023 16:17:21 -0600 Subject: [PATCH] Allow locking of already owned resources, considered nop and continues --- lockable.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lockable.go b/lockable.go index 069ab9a..0564279 100644 --- a/lockable.go +++ b/lockable.go @@ -408,7 +408,8 @@ func LockLockables(ctx * Context, to_lock []Lockable, new_owner Lockable, nodes if req.Owner() != nil { owner := req.Owner() if owner.ID() == new_owner.ID() { - return fmt.Errorf("LOCKABLE_LOCK_ERR: %s already owns %s, cannot lock again", new_owner.ID(), req.ID()) + // If we already own the lock, nothing to do + continue } else if owner.ID() == req.ID() { if req.AllowedToTakeLock(new_owner, req) == false { return fmt.Errorf("LOCKABLE_LOCK_ERR: %s is not allowed to take %s's lock from %s", new_owner.ID(), req.ID(), owner.ID())