Skip to content

Commit

Permalink
refactor: change order of validation of existing next delayed job
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf committed Jan 25, 2025
1 parent 178df1f commit 62f57de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/commands/addJobScheduler-6.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ local schedulerKey = repeatKey .. ":" .. jobSchedulerId
local nextDelayedJobId = "repeat:" .. jobSchedulerId .. ":" .. nextMillis
local nextDelayedJobKey = schedulerKey .. ":" .. nextMillis

local nextDelayedJobDoesNotExist = rcall("EXISTS", nextDelayedJobKey) ~= 1
-- If we are overriding a repeatable job we must delete the delayed job for
-- the next iteration.
local prevMillis = rcall("ZSCORE", repeatKey, jobSchedulerId)
Expand All @@ -101,6 +100,8 @@ local schedulerOpts = cmsgpack.unpack(ARGV[2])

storeRepeatableJob(jobSchedulerId, schedulerKey, repeatKey, nextMillis, schedulerOpts, ARGV[4], templateOpts)

local nextDelayedJobDoesNotExist = rcall("EXISTS", nextDelayedJobKey) ~= 1

if nextDelayedJobDoesNotExist then
local eventsKey = KEYS[5]
local metaKey = KEYS[2]
Expand Down

0 comments on commit 62f57de

Please sign in to comment.