isJobSchedulerJob.lua 503 B

123456789101112131415
  1. --[[
  2. Function to check if the job belongs to a job scheduler and
  3. current delayed job matches with jobId
  4. ]]
  5. local function isJobSchedulerJob(jobId, jobKey, jobSchedulersKey)
  6. local repeatJobKey = rcall("HGET", jobKey, "rjk")
  7. if repeatJobKey then
  8. local prevMillis = rcall("ZSCORE", jobSchedulersKey, repeatJobKey)
  9. if prevMillis then
  10. local currentDelayedJobId = "repeat:" .. repeatJobKey .. ":" .. prevMillis
  11. return jobId == currentDelayedJobId
  12. end
  13. end
  14. return false
  15. end