moveToDelayed contains duplicate lock GET
Created by: bruun
Description
While digging into some (probably unrelated) issue with missing locks for failed jobs that needs to be moved to "delayed", I took a look inside moveToDelayed-3.lua
and noticed there are two GET's for the lock:
-- Check for job lock
if ARGV[3] ~= "0" then
local lockKey = KEYS[3] .. ':lock'
local lock = rcall("GET", lockKey)
if rcall("GET", lockKey) ~= ARGV[3] then
return -2
end
end
The corresponding lock check in moveToFinished-7.lua
does not fetch the lock twice, which is why I'm wondering if this might be unintentional?
Also, the documentation in moveToDelayed
says the following:
Output:
0 - OK
-1 - Missing job.
-2 - Job is locked.
Shouldn't this be "-2 - Missing lock", like in moveToFinished-7.lua
?
If not, the error thrown when handling this error in scripts.finishedErrors
should probably be changed: Error: Missing lock for job <jobId> delayed
.
Bull version
3.22.4