extendLock-2.js 743 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.extendLock = void 0;
  4. const content = `--[[
  5. Extend lock and removes the job from the stalled set.
  6. Input:
  7. KEYS[1] 'lock',
  8. KEYS[2] 'stalled'
  9. ARGV[1] token
  10. ARGV[2] lock duration in milliseconds
  11. ARGV[3] jobid
  12. Output:
  13. "1" if lock extented succesfully.
  14. ]]
  15. local rcall = redis.call
  16. if rcall("GET", KEYS[1]) == ARGV[1] then
  17. -- if rcall("SET", KEYS[1], ARGV[1], "PX", ARGV[2], "XX") then
  18. if rcall("SET", KEYS[1], ARGV[1], "PX", ARGV[2]) then
  19. rcall("SREM", KEYS[2], ARGV[3])
  20. return 1
  21. end
  22. end
  23. return 0
  24. `;
  25. exports.extendLock = {
  26. name: 'extendLock',
  27. content,
  28. keys: 2,
  29. };
  30. //# sourceMappingURL=extendLock-2.js.map