removeChildDependency-1.lua 685 B

12345678910111213141516171819202122232425262728293031323334
  1. --[[
  2. Break parent-child dependency by removing
  3. child reference from parent
  4. Input:
  5. KEYS[1] 'key' prefix,
  6. ARGV[1] job key
  7. ARGV[2] parent key
  8. Output:
  9. 0 - OK
  10. 1 - There is not relationship.
  11. -1 - Missing job key
  12. -5 - Missing parent key
  13. ]]
  14. local rcall = redis.call
  15. local jobKey = ARGV[1]
  16. local parentKey = ARGV[2]
  17. -- Includes
  18. --- @include "includes/removeParentDependencyKey"
  19. if rcall("EXISTS", jobKey) ~= 1 then return -1 end
  20. if rcall("EXISTS", parentKey) ~= 1 then return -5 end
  21. if removeParentDependencyKey(jobKey, false, parentKey, KEYS[1], nil) then
  22. rcall("HDEL", jobKey, "parentKey", "parent")
  23. return 0
  24. else
  25. return 1
  26. end