extendLock-2.js 642 B

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