moveParentToWaitIfNeeded.lua 559 B

1234567891011121314
  1. --[[
  2. Validate and move parent to a wait status (waiting, delayed or prioritized) if needed.
  3. ]]
  4. -- Includes
  5. --- @include "moveParentToWait"
  6. local function moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
  7. if rcall("EXISTS", parentKey) == 1 then
  8. local parentWaitingChildrenKey = parentQueueKey .. ":waiting-children"
  9. if rcall("ZSCORE", parentWaitingChildrenKey, parentId) then
  10. rcall("ZREM", parentWaitingChildrenKey, parentId)
  11. moveParentToWait(parentQueueKey, parentKey, parentId, timestamp)
  12. end
  13. end
  14. end