From d327bb4af5640670976e13f78be8e7beaf833358 Mon Sep 17 00:00:00 2001 From: roggervalf Date: Sun, 12 Jan 2025 11:26:26 -0500 Subject: [PATCH] refactor(job-scheduler): move arg as a key in updateJobScheduler --- src/classes/scripts.ts | 2 +- ...dateJobScheduler-6.lua => updateJobScheduler-7.lua} | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) rename src/commands/{updateJobScheduler-6.lua => updateJobScheduler-7.lua} (91%) diff --git a/src/classes/scripts.ts b/src/classes/scripts.ts index b9b60217a1..93241de272 100644 --- a/src/classes/scripts.ts +++ b/src/classes/scripts.ts @@ -369,6 +369,7 @@ export class Scripts { queueKeys.delayed, queueKeys.events, queueKeys.repeat, + producerId ? this.queue.toKey(producerId) : '', ]; const args = [ @@ -377,7 +378,6 @@ export class Scripts { pack(delayedJobOpts), Date.now(), queueKeys[''], - producerId ? this.queue.toKey(producerId) : '', producerId, ]; diff --git a/src/commands/updateJobScheduler-6.lua b/src/commands/updateJobScheduler-7.lua similarity index 91% rename from src/commands/updateJobScheduler-6.lua rename to src/commands/updateJobScheduler-7.lua index 883d4af1d7..4a6b052312 100644 --- a/src/commands/updateJobScheduler-6.lua +++ b/src/commands/updateJobScheduler-7.lua @@ -8,14 +8,14 @@ KEYS[4] 'delayed' KEYS[5] events stream key KEYS[6] 'repeat' key + KEYS[7] producer key ARGV[1] next milliseconds ARGV[2] jobs scheduler id ARGV[3] msgpacked delayed opts ARGV[4] timestamp ARGV[5] prefix key - ARGV[6] producer key - ARGV[7] producer id + ARGV[6] producer id Output: next delayed job id - OK @@ -27,7 +27,7 @@ local timestamp = ARGV[4] local nextMillis = ARGV[1] local jobSchedulerId = ARGV[2] local prefixKey = ARGV[5] -local producerId = ARGV[7] +local producerId = ARGV[6] -- Includes --- @include "includes/addDelayedJob" @@ -58,8 +58,8 @@ if prevMillis ~= false then addDelayedJob(nextDelayedJobKey, nextDelayedJobId, delayedKey, eventsKey, schedulerAttributes[1], schedulerAttributes[2] or "{}", delayedOpts, timestamp, jobSchedulerId, maxEvents, KEYS[1], nil, nil) - if ARGV[6] ~= "" then - rcall("HSET", ARGV[6], "nrjid", nextDelayedJobId) + if KEYS[7] ~= "" then + rcall("HSET", KEYS[7], "nrjid", nextDelayedJobId) end return nextDelayedJobId .. "" -- convert to string