Skip to content

Commit

Permalink
fix(flow): validate parentData before ignoreDependencyOnFailure when …
Browse files Browse the repository at this point in the history
…stalled check happens (#2702) (python)
  • Loading branch information
roggervalf authored Aug 10, 2024
1 parent 8260582 commit 9416501
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions src/commands/moveStalledJobsToWait-9.lua
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,29 @@ if (#stalling > 0) then
"failed", "jobId", jobId, 'prev', 'active',
'failedReason', failedReason)

if opts['fpof'] and rawParentData ~= false then
local parentData = cjson.decode(rawParentData)
moveParentFromWaitingChildrenToFailed(
parentData['queueKey'],
parentData['queueKey'] .. ':' .. parentData['id'],
parentData['id'],
jobKey,
timestamp
)
elseif opts['idof'] then
local parentData = cjson.decode(rawParentData)
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
local dependenciesSet = parentKey .. ":dependencies"
if rcall("SREM", dependenciesSet, jobKey) == 1 then
moveParentToWaitIfNeeded(parentData['queueKey'], dependenciesSet,
parentKey, parentData['id'], timestamp)
local failedSet = parentKey .. ":failed"
rcall("HSET", failedSet, jobKey, failedReason)
if rawParentData ~= false then
if opts['fpof'] then
local parentData = cjson.decode(rawParentData)
moveParentFromWaitingChildrenToFailed(
parentData['queueKey'],
parentData['queueKey'] .. ':' .. parentData['id'],
parentData['id'],
jobKey,
timestamp
)
elseif opts['idof'] then
local parentData = cjson.decode(rawParentData)
local parentKey = parentData['queueKey'] .. ':' .. parentData['id']
local dependenciesSet = parentKey .. ":dependencies"
if rcall("SREM", dependenciesSet, jobKey) == 1 then
moveParentToWaitIfNeeded(parentData['queueKey'], dependenciesSet,
parentKey, parentData['id'], timestamp)
local failedSet = parentKey .. ":failed"
rcall("HSET", failedSet, jobKey, failedReason)
end
end
end

if removeOnFailType == "number" then
removeJobsByMaxCount(opts["removeOnFail"],
failedKey, queueKeyPrefix)
Expand Down

0 comments on commit 9416501

Please sign in to comment.