updateExistingJobsParent.lua 1.1 KB

123456789101112131415161718192021222324252627
  1. --[[
  2. This function is used to update the parent's dependencies if the job
  3. is already completed and about to be ignored. The parent must get its
  4. dependencies updated to avoid the parent job being stuck forever in
  5. the waiting-children state.
  6. ]]
  7. -- Includes
  8. --- @include "updateParentDepsIfNeeded"
  9. local function updateExistingJobsParent(parentKey, parent, parentData,
  10. parentDependenciesKey, completedKey,
  11. jobIdKey, jobId, timestamp)
  12. if parentKey ~= nil then
  13. if rcall("ZSCORE", completedKey, jobId) then
  14. local returnvalue = rcall("HGET", jobIdKey, "returnvalue")
  15. updateParentDepsIfNeeded(parentKey, parent['queueKey'],
  16. parentDependenciesKey, parent['id'],
  17. jobIdKey, returnvalue, timestamp)
  18. else
  19. if parentDependenciesKey ~= nil then
  20. rcall("SADD", parentDependenciesKey, jobIdKey)
  21. end
  22. end
  23. rcall("HMSET", jobIdKey, "parentKey", parentKey, "parent", parentData)
  24. end
  25. end