Skip to content

fix(run.go): defer Unlock moved to after Lock#487

Merged
ilyalavrenov merged 2 commits into
loomhq:mainfrom
devopsjourney1:patch-1
Dec 4, 2025
Merged

fix(run.go): defer Unlock moved to after Lock#487
ilyalavrenov merged 2 commits into
loomhq:mainfrom
devopsjourney1:patch-1

Conversation

@devopsjourney1

Copy link
Copy Markdown
Contributor

What:

Defer placed AFTER Lock() succeeds to avoid unlocking when we don't hold the lock.

Why:

Was running into the following scenario on a multi cluster setup:

  1. Cluster1 would run the job and create the lock 👍
  2. Cluster2 would attempt to run the job, would see the lock 👍.. however it removed the lock when it quit out 👎
  3. Cluster3 would run the job since there was no longer a lock (removed by cluster2) 👎

This fix makes it so if lock-exec fails to create the lock it will not remove any existing locks. Existing locks will only be removed by jobs that create the lock OR if the TTL expires.

@devopsjourney1 devopsjourney1 requested a review from a team as a code owner December 2, 2025 23:38

@lingrino lingrino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great change, thank you!

@ilyalavrenov ilyalavrenov merged commit 899148e into loomhq:main Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants