getStateV2-8.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getStateV2 = void 0;
  4. const content = `--[[
  5. Get a job state
  6. Input:
  7. KEYS[1] 'completed' key,
  8. KEYS[2] 'failed' key
  9. KEYS[3] 'delayed' key
  10. KEYS[4] 'active' key
  11. KEYS[5] 'wait' key
  12. KEYS[6] 'paused' key
  13. KEYS[7] 'waiting-children' key
  14. KEYS[8] 'prioritized' key
  15. ARGV[1] job id
  16. Output:
  17. 'completed'
  18. 'failed'
  19. 'delayed'
  20. 'active'
  21. 'waiting'
  22. 'waiting-children'
  23. 'unknown'
  24. ]]
  25. local rcall = redis.call
  26. if rcall("ZSCORE", KEYS[1], ARGV[1]) then
  27. return "completed"
  28. end
  29. if rcall("ZSCORE", KEYS[2], ARGV[1]) then
  30. return "failed"
  31. end
  32. if rcall("ZSCORE", KEYS[3], ARGV[1]) then
  33. return "delayed"
  34. end
  35. if rcall("ZSCORE", KEYS[8], ARGV[1]) then
  36. return "prioritized"
  37. end
  38. if rcall("LPOS", KEYS[4] , ARGV[1]) then
  39. return "active"
  40. end
  41. if rcall("LPOS", KEYS[5] , ARGV[1]) then
  42. return "waiting"
  43. end
  44. if rcall("LPOS", KEYS[6] , ARGV[1]) then
  45. return "waiting"
  46. end
  47. if rcall("ZSCORE", KEYS[7] , ARGV[1]) then
  48. return "waiting-children"
  49. end
  50. return "unknown"
  51. `;
  52. exports.getStateV2 = {
  53. name: 'getStateV2',
  54. content,
  55. keys: 8,
  56. };
  57. //# sourceMappingURL=getStateV2-8.js.map