Allow locking of already owned resources, considered nop and continues

graph-rework-2
noah metz 2023-07-11 16:17:21 -06:00
parent 88d8113b5c
commit e5ba988f01
1 changed files with 2 additions and 1 deletions

@ -408,7 +408,8 @@ func LockLockables(ctx * Context, to_lock []Lockable, new_owner Lockable, nodes
if req.Owner() != nil { if req.Owner() != nil {
owner := req.Owner() owner := req.Owner()
if owner.ID() == new_owner.ID() { 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() { } else if owner.ID() == req.ID() {
if req.AllowedToTakeLock(new_owner, req) == false { 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()) return fmt.Errorf("LOCKABLE_LOCK_ERR: %s is not allowed to take %s's lock from %s", new_owner.ID(), req.ID(), owner.ID())