-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(repeat): replace delayed job when updating repeat key
- Loading branch information
Showing
7 changed files
with
165 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--[[ | ||
Adds a repeatable job | ||
Input: | ||
KEYS[1] 'repeat' key | ||
ARGV[1] next milliseconds | ||
ARGV[2] custom key | ||
ARGV[3] legacy custom key TODO: remove this logic in next breaking change | ||
Output: | ||
repeatableKey - OK | ||
]] | ||
local rcall = redis.call | ||
local repeatKey = KEYS[1] | ||
local nextMillis = ARGV[1] | ||
local customKey = ARGV[2] | ||
local legacyCustomKey = ARGV[3] | ||
|
||
if rcall("ZSCORE", repeatKey, customKey) ~= false then | ||
rcall("ZADD", repeatKey, nextMillis, customKey) | ||
return customKey | ||
elseif rcall("ZSCORE", repeatKey, legacyCustomKey) ~= false then | ||
rcall("ZADD", repeatKey, nextMillis, legacyCustomKey) | ||
return legacyCustomKey | ||
end | ||
|
||
return '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters