-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(scripts): throw error when moving non-active job to delayed (#2740)
- Loading branch information
1 parent
728f524
commit 63636b1
Showing
5 changed files
with
44 additions
and
15 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
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
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