Skip to content

Commit

Permalink
refactor: join statements into the same if statement
Browse files Browse the repository at this point in the history
  • Loading branch information
manast committed Sep 26, 2023
1 parent 4245612 commit 1cb502c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/commands/moveToActive-10.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ local expireTime = getRateLimitTTL(maxJobs, rateLimiterKey)
local jobId = nil
if ARGV[3] ~= "" then
jobId = ARGV[3]
end

if jobId then
-- clean stalled key
rcall("SREM", KEYS[5], jobId)
end

if not jobId or (jobId and string.sub(jobId, 1, 2) == "0:") then
-- If jobId is special ID 0:delay, then there is no job to process
if jobId then rcall("LREM", activeKey, 1, jobId) end

-- Check if we are rate limited first.
Expand All @@ -86,7 +85,6 @@ if not jobId or (jobId and string.sub(jobId, 1, 2) == "0:") then
end
end

-- If jobId is special ID 0:delay, then there is no job to process
if jobId then
return prepareJobForProcessing(KEYS, ARGV[1], target, jobId, ARGV[2],
maxJobs, expireTime, opts)
Expand Down

0 comments on commit 1cb502c

Please sign in to comment.