Skip to content

Commit

Permalink
refactor(job): pass prefix into changePriority for extension (#2777)
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Sep 20, 2024
1 parent 68c415d commit e170733
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/classes/scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ export class Scripts {
}
}

private changePriorityArgs(
protected changePriorityArgs(
jobId: string,
priority = 0,
lifo = false,
Expand All @@ -863,7 +863,7 @@ export class Scripts {

return keys.concat([
priority,
this.queue.toKey(jobId),
this.queue.toKey(''),
jobId,
lifo ? 1 : 0,
]);
Expand Down
6 changes: 3 additions & 3 deletions src/commands/changePriority-7.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
KEYS[7] 'marker'
ARGV[1] priority value
ARGV[2] job key
ARGV[2] prefix key
ARGV[3] job id
ARGV[4] lifo
Output:
0 - OK
-1 - Missing job
]]
local jobKey = ARGV[2]
local jobId = ARGV[3]
local jobKey = ARGV[2] .. jobId
local priority = tonumber(ARGV[1])
local rcall = redis.call

Expand Down Expand Up @@ -52,7 +52,7 @@ if rcall("EXISTS", jobKey) == 1 then
local markerKey = KEYS[7]

-- Re-add with the new priority
if rcall("ZREM", KEYS[4], jobId) > 0 then
if rcall("ZREM", prioritizedKey, jobId) > 0 then
reAddJobWithNewPriority( prioritizedKey, markerKey, target,
priorityCounterKey, ARGV[4] == '1', priority, jobId, isPausedOrMaxed)
elseif rcall("LREM", target, -1, jobId) > 0 then
Expand Down

0 comments on commit e170733

Please sign in to comment.