updateRepeatableJobMillis-1.js 854 B

123456789101112131415161718192021222324252627282930
  1. const content = `--[[
  2. Adds a repeatable job
  3. Input:
  4. KEYS[1] 'repeat' key
  5. ARGV[1] next milliseconds
  6. ARGV[2] custom key
  7. ARGV[3] legacy custom key TODO: remove this logic in next breaking change
  8. Output:
  9. repeatableKey - OK
  10. ]]
  11. local rcall = redis.call
  12. local repeatKey = KEYS[1]
  13. local nextMillis = ARGV[1]
  14. local customKey = ARGV[2]
  15. local legacyCustomKey = ARGV[3]
  16. if rcall("ZSCORE", repeatKey, customKey) then
  17. rcall("ZADD", repeatKey, nextMillis, customKey)
  18. return customKey
  19. elseif rcall("ZSCORE", repeatKey, legacyCustomKey) ~= false then
  20. rcall("ZADD", repeatKey, nextMillis, legacyCustomKey)
  21. return legacyCustomKey
  22. end
  23. return ''
  24. `;
  25. export const updateRepeatableJobMillis = {
  26. name: 'updateRepeatableJobMillis',
  27. content,
  28. keys: 1,
  29. };
  30. //# sourceMappingURL=updateRepeatableJobMillis-1.js.map