-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(stalled): remove jobId from stalled after removing lock when mov…
…ed from active (#2512) (python)
- Loading branch information
1 parent
f875ddd
commit 64feec9
Showing
6 changed files
with
64 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
local function removeLock(jobKey, stalledKey, token, jobId) | ||
if token ~= "0" then | ||
local lockKey = jobKey .. ':lock' | ||
local lockToken = rcall("GET", lockKey) | ||
if lockToken == token then | ||
rcall("DEL", lockKey) | ||
rcall("SREM", stalledKey, jobId) | ||
else | ||
if lockToken then | ||
-- Lock exists but token does not match | ||
return -6 | ||
else | ||
-- Lock is missing completely | ||
return -2 | ||
end | ||
end | ||
end | ||
return 0 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters