bullmq 5.49.2 → 5.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/classes/job.js +20 -18
- package/dist/cjs/classes/job.js.map +1 -1
- package/dist/cjs/classes/queue.js +0 -1
- package/dist/cjs/classes/queue.js.map +1 -1
- package/dist/cjs/commands/includes/moveChildFromDependenciesIfNeeded.lua +0 -1
- package/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
- package/dist/cjs/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
- package/dist/cjs/commands/includes/removeJob.lua +2 -2
- package/dist/cjs/commands/includes/removeJobWithChildren.lua +2 -2
- package/dist/cjs/commands/moveStalledJobsToWait-9.lua +2 -2
- package/dist/cjs/commands/moveToFinished-14.lua +2 -2
- package/dist/cjs/commands/moveToWaitingChildren-8.lua +2 -2
- package/dist/cjs/scripts/addJobScheduler-11.js +9 -4
- package/dist/cjs/scripts/addJobScheduler-11.js.map +1 -1
- package/dist/cjs/scripts/addRepeatableJob-2.js +9 -4
- package/dist/cjs/scripts/addRepeatableJob-2.js.map +1 -1
- package/dist/cjs/scripts/cleanJobsInSet-3.js +9 -4
- package/dist/cjs/scripts/cleanJobsInSet-3.js.map +1 -1
- package/dist/cjs/scripts/drain-5.js +9 -4
- package/dist/cjs/scripts/drain-5.js.map +1 -1
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js +30 -17
- package/dist/cjs/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-14.js +30 -17
- package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
- package/dist/cjs/scripts/moveToWaitingChildren-8.js +30 -17
- package/dist/cjs/scripts/moveToWaitingChildren-8.js.map +1 -1
- package/dist/cjs/scripts/obliterate-2.js +9 -4
- package/dist/cjs/scripts/obliterate-2.js.map +1 -1
- package/dist/cjs/scripts/removeJob-3.js +9 -4
- package/dist/cjs/scripts/removeJob-3.js.map +1 -1
- package/dist/cjs/scripts/removeUnprocessedChildren-2.js +9 -4
- package/dist/cjs/scripts/removeUnprocessedChildren-2.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils.js +11 -1
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/job.d.ts +16 -4
- package/dist/esm/classes/job.js +21 -19
- package/dist/esm/classes/job.js.map +1 -1
- package/dist/esm/classes/queue.d.ts +0 -1
- package/dist/esm/classes/queue.js +0 -1
- package/dist/esm/classes/queue.js.map +1 -1
- package/dist/esm/commands/includes/moveChildFromDependenciesIfNeeded.lua +0 -1
- package/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnFinalization.lua +23 -0
- package/dist/esm/commands/includes/removeDeduplicationKeyIfNeededOnRemoval.lua +16 -0
- package/dist/esm/commands/includes/removeJob.lua +2 -2
- package/dist/esm/commands/includes/removeJobWithChildren.lua +2 -2
- package/dist/esm/commands/moveStalledJobsToWait-9.lua +2 -2
- package/dist/esm/commands/moveToFinished-14.lua +2 -2
- package/dist/esm/commands/moveToWaitingChildren-8.lua +2 -2
- package/dist/esm/scripts/addJobScheduler-11.js +9 -4
- package/dist/esm/scripts/addJobScheduler-11.js.map +1 -1
- package/dist/esm/scripts/addRepeatableJob-2.js +9 -4
- package/dist/esm/scripts/addRepeatableJob-2.js.map +1 -1
- package/dist/esm/scripts/cleanJobsInSet-3.js +9 -4
- package/dist/esm/scripts/cleanJobsInSet-3.js.map +1 -1
- package/dist/esm/scripts/drain-5.js +9 -4
- package/dist/esm/scripts/drain-5.js.map +1 -1
- package/dist/esm/scripts/moveStalledJobsToWait-9.js +30 -17
- package/dist/esm/scripts/moveStalledJobsToWait-9.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-14.js +30 -17
- package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
- package/dist/esm/scripts/moveToWaitingChildren-8.js +30 -17
- package/dist/esm/scripts/moveToWaitingChildren-8.js.map +1 -1
- package/dist/esm/scripts/obliterate-2.js +9 -4
- package/dist/esm/scripts/obliterate-2.js.map +1 -1
- package/dist/esm/scripts/removeJob-3.js +9 -4
- package/dist/esm/scripts/removeJob-3.js.map +1 -1
- package/dist/esm/scripts/removeUnprocessedChildren-2.js +9 -4
- package/dist/esm/scripts/removeUnprocessedChildren-2.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/utils.d.ts +17 -0
- package/dist/esm/utils.js +10 -0
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/commands/includes/removeDeduplicationKey.lua +0 -11
- package/dist/cjs/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
- package/dist/esm/commands/includes/removeDeduplicationKey.lua +0 -11
- package/dist/esm/commands/includes/removeDeduplicationKeyIfNeeded.lua +0 -14
@@ -197,18 +197,6 @@ local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDep
|
|
197
197
|
moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
|
198
198
|
end
|
199
199
|
end
|
200
|
-
--[[
|
201
|
-
Function to remove deduplication key if needed.
|
202
|
-
]]
|
203
|
-
local function removeDeduplicationKeyIfNeeded(prefixKey, deduplicationId)
|
204
|
-
if deduplicationId then
|
205
|
-
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
206
|
-
local pttl = rcall("PTTL", deduplicationKey)
|
207
|
-
if pttl == 0 or pttl == -1 then
|
208
|
-
rcall("DEL", deduplicationKey)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
200
|
--[[
|
213
201
|
Functions to remove jobs when removeOnFail option is provided.
|
214
202
|
]]
|
@@ -218,13 +206,18 @@ end
|
|
218
206
|
]]
|
219
207
|
-- Includes
|
220
208
|
--[[
|
221
|
-
Function to remove deduplication key
|
209
|
+
Function to remove deduplication key if needed
|
210
|
+
when a job is being removed.
|
222
211
|
]]
|
223
|
-
local function
|
212
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
213
|
+
jobKey, jobId)
|
224
214
|
local deduplicationId = rcall("HGET", jobKey, "deid")
|
225
215
|
if deduplicationId then
|
226
216
|
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
227
|
-
rcall(
|
217
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
218
|
+
if currentJobId and currentJobId == jobId then
|
219
|
+
return rcall("DEL", deduplicationKey)
|
220
|
+
end
|
228
221
|
end
|
229
222
|
end
|
230
223
|
--[[
|
@@ -326,7 +319,7 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
|
|
326
319
|
local jobKey = baseKey .. jobId
|
327
320
|
removeParentDependencyKey(jobKey, hard, nil, baseKey)
|
328
321
|
if shouldRemoveDeduplicationKey then
|
329
|
-
|
322
|
+
removeDeduplicationKeyIfNeededOnRemoval(baseKey, jobKey, jobId)
|
330
323
|
end
|
331
324
|
removeJobKeys(jobKey)
|
332
325
|
end
|
@@ -446,6 +439,26 @@ moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedRea
|
|
446
439
|
end
|
447
440
|
end
|
448
441
|
end
|
442
|
+
--[[
|
443
|
+
Function to remove deduplication key if needed
|
444
|
+
when a job is moved to completed or failed states.
|
445
|
+
]]
|
446
|
+
local function removeDeduplicationKeyIfNeededOnFinalization(prefixKey,
|
447
|
+
deduplicationId, jobId)
|
448
|
+
if deduplicationId then
|
449
|
+
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
450
|
+
local pttl = rcall("PTTL", deduplicationKey)
|
451
|
+
if pttl == 0 then
|
452
|
+
return rcall("DEL", deduplicationKey)
|
453
|
+
end
|
454
|
+
if pttl == -1 then
|
455
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
456
|
+
if currentJobId and currentJobId == jobId then
|
457
|
+
return rcall("DEL", deduplicationKey)
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
end
|
449
462
|
--[[
|
450
463
|
Function to trim events, default 10000.
|
451
464
|
]]
|
@@ -515,7 +528,7 @@ if (#stalling > 0) then
|
|
515
528
|
local rawParentData = jobAttributes[2]
|
516
529
|
local opts = cjson.decode(rawOpts)
|
517
530
|
rcall("ZADD", failedKey, timestamp, jobId)
|
518
|
-
|
531
|
+
removeDeduplicationKeyIfNeededOnFinalization(queueKeyPrefix, jobAttributes[3], jobId)
|
519
532
|
local failedReason = "job stalled more than allowable limit"
|
520
533
|
rcall("HMSET", jobKey, "failedReason", failedReason, "finishedOn", timestamp)
|
521
534
|
rcall("XADD", eventStreamKey, "*", "event", "failed", "jobId", jobId, 'prev', 'active',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveStalledJobsToWait-9.js","sourceRoot":"","sources":["../../../src/scripts/moveStalledJobsToWait-9.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6iBf,CAAC;AACW,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -293,18 +293,6 @@ local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDep
|
|
293
293
|
moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
|
294
294
|
end
|
295
295
|
end
|
296
|
-
--[[
|
297
|
-
Function to remove deduplication key if needed.
|
298
|
-
]]
|
299
|
-
local function removeDeduplicationKeyIfNeeded(prefixKey, deduplicationId)
|
300
|
-
if deduplicationId then
|
301
|
-
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
302
|
-
local pttl = rcall("PTTL", deduplicationKey)
|
303
|
-
if pttl == 0 or pttl == -1 then
|
304
|
-
rcall("DEL", deduplicationKey)
|
305
|
-
end
|
306
|
-
end
|
307
|
-
end
|
308
296
|
--[[
|
309
297
|
Functions to remove jobs when removeOnFail option is provided.
|
310
298
|
]]
|
@@ -314,13 +302,18 @@ end
|
|
314
302
|
]]
|
315
303
|
-- Includes
|
316
304
|
--[[
|
317
|
-
Function to remove deduplication key
|
305
|
+
Function to remove deduplication key if needed
|
306
|
+
when a job is being removed.
|
318
307
|
]]
|
319
|
-
local function
|
308
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
309
|
+
jobKey, jobId)
|
320
310
|
local deduplicationId = rcall("HGET", jobKey, "deid")
|
321
311
|
if deduplicationId then
|
322
312
|
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
323
|
-
rcall(
|
313
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
314
|
+
if currentJobId and currentJobId == jobId then
|
315
|
+
return rcall("DEL", deduplicationKey)
|
316
|
+
end
|
324
317
|
end
|
325
318
|
end
|
326
319
|
--[[
|
@@ -422,7 +415,7 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
|
|
422
415
|
local jobKey = baseKey .. jobId
|
423
416
|
removeParentDependencyKey(jobKey, hard, nil, baseKey)
|
424
417
|
if shouldRemoveDeduplicationKey then
|
425
|
-
|
418
|
+
removeDeduplicationKeyIfNeededOnRemoval(baseKey, jobKey, jobId)
|
426
419
|
end
|
427
420
|
removeJobKeys(jobKey)
|
428
421
|
end
|
@@ -611,6 +604,26 @@ local function promoteDelayedJobs(delayedKey, markerKey, targetKey, prioritizedK
|
|
611
604
|
addBaseMarkerIfNeeded(markerKey, isPaused)
|
612
605
|
end
|
613
606
|
end
|
607
|
+
--[[
|
608
|
+
Function to remove deduplication key if needed
|
609
|
+
when a job is moved to completed or failed states.
|
610
|
+
]]
|
611
|
+
local function removeDeduplicationKeyIfNeededOnFinalization(prefixKey,
|
612
|
+
deduplicationId, jobId)
|
613
|
+
if deduplicationId then
|
614
|
+
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
615
|
+
local pttl = rcall("PTTL", deduplicationKey)
|
616
|
+
if pttl == 0 then
|
617
|
+
return rcall("DEL", deduplicationKey)
|
618
|
+
end
|
619
|
+
if pttl == -1 then
|
620
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
621
|
+
if currentJobId and currentJobId == jobId then
|
622
|
+
return rcall("DEL", deduplicationKey)
|
623
|
+
end
|
624
|
+
end
|
625
|
+
end
|
626
|
+
end
|
614
627
|
local function removeLock(jobKey, stalledKey, token, jobId)
|
615
628
|
if token ~= "0" then
|
616
629
|
local lockKey = jobKey .. ':lock'
|
@@ -715,7 +728,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- Make sure job exists
|
|
715
728
|
-- Trim events before emiting them to avoid trimming events emitted in this script
|
716
729
|
trimEvents(metaKey, eventStreamKey)
|
717
730
|
local prefix = ARGV[7]
|
718
|
-
|
731
|
+
removeDeduplicationKeyIfNeededOnFinalization(prefix, jobAttributes[3], jobId)
|
719
732
|
-- If job has a parent we need to
|
720
733
|
-- 1) remove this job id from parents dependencies
|
721
734
|
-- 2) move the job Id to parent "processed" set
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveToFinished-14.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-14.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAi1Bf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|
@@ -194,18 +194,6 @@ local function moveParentToWaitIfNoPendingDependencies(parentQueueKey, parentDep
|
|
194
194
|
moveParentToWaitIfNeeded(parentQueueKey, parentKey, parentId, timestamp)
|
195
195
|
end
|
196
196
|
end
|
197
|
-
--[[
|
198
|
-
Function to remove deduplication key if needed.
|
199
|
-
]]
|
200
|
-
local function removeDeduplicationKeyIfNeeded(prefixKey, deduplicationId)
|
201
|
-
if deduplicationId then
|
202
|
-
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
203
|
-
local pttl = rcall("PTTL", deduplicationKey)
|
204
|
-
if pttl == 0 or pttl == -1 then
|
205
|
-
rcall("DEL", deduplicationKey)
|
206
|
-
end
|
207
|
-
end
|
208
|
-
end
|
209
197
|
--[[
|
210
198
|
Functions to remove jobs when removeOnFail option is provided.
|
211
199
|
]]
|
@@ -215,13 +203,18 @@ end
|
|
215
203
|
]]
|
216
204
|
-- Includes
|
217
205
|
--[[
|
218
|
-
Function to remove deduplication key
|
206
|
+
Function to remove deduplication key if needed
|
207
|
+
when a job is being removed.
|
219
208
|
]]
|
220
|
-
local function
|
209
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
210
|
+
jobKey, jobId)
|
221
211
|
local deduplicationId = rcall("HGET", jobKey, "deid")
|
222
212
|
if deduplicationId then
|
223
213
|
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
224
|
-
rcall(
|
214
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
215
|
+
if currentJobId and currentJobId == jobId then
|
216
|
+
return rcall("DEL", deduplicationKey)
|
217
|
+
end
|
225
218
|
end
|
226
219
|
end
|
227
220
|
--[[
|
@@ -323,7 +316,7 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
|
|
323
316
|
local jobKey = baseKey .. jobId
|
324
317
|
removeParentDependencyKey(jobKey, hard, nil, baseKey)
|
325
318
|
if shouldRemoveDeduplicationKey then
|
326
|
-
|
319
|
+
removeDeduplicationKeyIfNeededOnRemoval(baseKey, jobKey, jobId)
|
327
320
|
end
|
328
321
|
removeJobKeys(jobKey)
|
329
322
|
end
|
@@ -443,6 +436,26 @@ moveChildFromDependenciesIfNeeded = function (rawParentData, childKey, failedRea
|
|
443
436
|
end
|
444
437
|
end
|
445
438
|
end
|
439
|
+
--[[
|
440
|
+
Function to remove deduplication key if needed
|
441
|
+
when a job is moved to completed or failed states.
|
442
|
+
]]
|
443
|
+
local function removeDeduplicationKeyIfNeededOnFinalization(prefixKey,
|
444
|
+
deduplicationId, jobId)
|
445
|
+
if deduplicationId then
|
446
|
+
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
447
|
+
local pttl = rcall("PTTL", deduplicationKey)
|
448
|
+
if pttl == 0 then
|
449
|
+
return rcall("DEL", deduplicationKey)
|
450
|
+
end
|
451
|
+
if pttl == -1 then
|
452
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
453
|
+
if currentJobId and currentJobId == jobId then
|
454
|
+
return rcall("DEL", deduplicationKey)
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
446
459
|
local function removeLock(jobKey, stalledKey, token, jobId)
|
447
460
|
if token ~= "0" then
|
448
461
|
local lockKey = jobKey .. ':lock'
|
@@ -476,7 +489,7 @@ if rcall("EXISTS", jobKey) == 1 then
|
|
476
489
|
if rcall("ZCARD", jobUnsuccessfulKey) ~= 0 then
|
477
490
|
-- TODO: refactor this logic in an include later
|
478
491
|
local jobAttributes = rcall("HMGET", jobKey, "parent", "deid", "opts")
|
479
|
-
|
492
|
+
removeDeduplicationKeyIfNeededOnFinalization(ARGV[5], jobAttributes[2], jobId)
|
480
493
|
local failedReason = "children are failed"
|
481
494
|
rcall("ZADD", failedKey, timestamp, jobId)
|
482
495
|
rcall("HSET", jobKey, "finishedOn", timestamp)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveToWaitingChildren-8.js","sourceRoot":"","sources":["../../../src/scripts/moveToWaitingChildren-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveToWaitingChildren-8.js","sourceRoot":"","sources":["../../../src/scripts/moveToWaitingChildren-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2gBf,CAAC;AACW,QAAA,qBAAqB,GAAG;IACnC,IAAI,EAAE,uBAAuB;IAC7B,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -28,13 +28,18 @@ local rcall = redis.call
|
|
28
28
|
]]
|
29
29
|
-- Includes
|
30
30
|
--[[
|
31
|
-
Function to remove deduplication key
|
31
|
+
Function to remove deduplication key if needed
|
32
|
+
when a job is being removed.
|
32
33
|
]]
|
33
|
-
local function
|
34
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
35
|
+
jobKey, jobId)
|
34
36
|
local deduplicationId = rcall("HGET", jobKey, "deid")
|
35
37
|
if deduplicationId then
|
36
38
|
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
37
|
-
rcall(
|
39
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
40
|
+
if currentJobId and currentJobId == jobId then
|
41
|
+
return rcall("DEL", deduplicationKey)
|
42
|
+
end
|
38
43
|
end
|
39
44
|
end
|
40
45
|
--[[
|
@@ -172,7 +177,7 @@ local function removeJob(jobId, hard, baseKey, shouldRemoveDeduplicationKey)
|
|
172
177
|
local jobKey = baseKey .. jobId
|
173
178
|
removeParentDependencyKey(jobKey, hard, nil, baseKey)
|
174
179
|
if shouldRemoveDeduplicationKey then
|
175
|
-
|
180
|
+
removeDeduplicationKeyIfNeededOnRemoval(baseKey, jobKey, jobId)
|
176
181
|
end
|
177
182
|
removeJobKeys(jobKey)
|
178
183
|
end
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"obliterate-2.js","sourceRoot":"","sources":["../../../src/scripts/obliterate-2.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"obliterate-2.js","sourceRoot":"","sources":["../../../src/scripts/obliterate-2.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Uf,CAAC;AACW,QAAA,UAAU,GAAG;IACxB,IAAI,EAAE,YAAY;IAClB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -91,13 +91,18 @@ local function getOrSetMaxEvents(metaKey)
|
|
91
91
|
return maxEvents
|
92
92
|
end
|
93
93
|
--[[
|
94
|
-
Function to remove deduplication key
|
94
|
+
Function to remove deduplication key if needed
|
95
|
+
when a job is being removed.
|
95
96
|
]]
|
96
|
-
local function
|
97
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
98
|
+
jobKey, jobId)
|
97
99
|
local deduplicationId = rcall("HGET", jobKey, "deid")
|
98
100
|
if deduplicationId then
|
99
101
|
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
100
|
-
rcall(
|
102
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
103
|
+
if currentJobId and currentJobId == jobId then
|
104
|
+
return rcall("DEL", deduplicationKey)
|
105
|
+
end
|
101
106
|
end
|
102
107
|
end
|
103
108
|
--[[
|
@@ -309,7 +314,7 @@ removeJobWithChildren = function(prefix, meta, jobId, parentKey, options)
|
|
309
314
|
removeJobChildren(prefix, meta, jobKey, options)
|
310
315
|
end
|
311
316
|
local prev = removeJobFromAnyState(prefix, jobId)
|
312
|
-
|
317
|
+
removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
|
313
318
|
if removeJobKeys(jobKey) > 0 then
|
314
319
|
local maxEvents = getOrSetMaxEvents(meta)
|
315
320
|
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"removeJob-3.js","sourceRoot":"","sources":["../../../src/scripts/removeJob-3.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"removeJob-3.js","sourceRoot":"","sources":["../../../src/scripts/removeJob-3.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoVf,CAAC;AACW,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,WAAW;IACjB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -58,13 +58,18 @@ local function isJobSchedulerJob(jobId, jobKey, jobSchedulersKey)
|
|
58
58
|
return false
|
59
59
|
end
|
60
60
|
--[[
|
61
|
-
Function to remove deduplication key
|
61
|
+
Function to remove deduplication key if needed
|
62
|
+
when a job is being removed.
|
62
63
|
]]
|
63
|
-
local function
|
64
|
+
local function removeDeduplicationKeyIfNeededOnRemoval(prefixKey,
|
65
|
+
jobKey, jobId)
|
64
66
|
local deduplicationId = rcall("HGET", jobKey, "deid")
|
65
67
|
if deduplicationId then
|
66
68
|
local deduplicationKey = prefixKey .. "de:" .. deduplicationId
|
67
|
-
rcall(
|
69
|
+
local currentJobId = rcall('GET', deduplicationKey)
|
70
|
+
if currentJobId and currentJobId == jobId then
|
71
|
+
return rcall("DEL", deduplicationKey)
|
72
|
+
end
|
68
73
|
end
|
69
74
|
end
|
70
75
|
--[[
|
@@ -306,7 +311,7 @@ removeJobWithChildren = function(prefix, meta, jobId, parentKey, options)
|
|
306
311
|
removeJobChildren(prefix, meta, jobKey, options)
|
307
312
|
end
|
308
313
|
local prev = removeJobFromAnyState(prefix, jobId)
|
309
|
-
|
314
|
+
removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
|
310
315
|
if removeJobKeys(jobKey) > 0 then
|
311
316
|
local maxEvents = getOrSetMaxEvents(meta)
|
312
317
|
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"removeUnprocessedChildren-2.js","sourceRoot":"","sources":["../../../src/scripts/removeUnprocessedChildren-2.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"removeUnprocessedChildren-2.js","sourceRoot":"","sources":["../../../src/scripts/removeUnprocessedChildren-2.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwUf,CAAC;AACW,QAAA,yBAAyB,GAAG;IACvC,IAAI,EAAE,2BAA2B;IACjC,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|