bullmq 5.52.0 → 5.52.1
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/scripts.js +1 -1
- package/dist/cjs/classes/scripts.js.map +1 -1
- package/dist/cjs/commands/includes/removeJobWithChildren.lua +9 -8
- package/dist/cjs/commands/{removeJob-3.lua → removeJob-2.lua} +3 -5
- package/dist/cjs/commands/removeUnprocessedChildren-2.lua +1 -1
- package/dist/cjs/scripts/index.js +1 -1
- package/dist/cjs/scripts/{removeJob-3.js → removeJob-2.js} +14 -15
- package/dist/cjs/scripts/{removeJob-3.js.map → removeJob-2.js.map} +1 -1
- package/dist/cjs/scripts/removeUnprocessedChildren-2.js +10 -9
- package/dist/cjs/scripts/removeUnprocessedChildren-2.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/scripts.js +1 -1
- package/dist/esm/classes/scripts.js.map +1 -1
- package/dist/esm/commands/includes/removeJobWithChildren.lua +9 -8
- package/dist/esm/commands/{removeJob-3.lua → removeJob-2.lua} +3 -5
- package/dist/esm/commands/removeUnprocessedChildren-2.lua +1 -1
- package/dist/esm/scripts/index.d.ts +1 -1
- package/dist/esm/scripts/index.js +1 -1
- package/dist/esm/scripts/{removeJob-3.js → removeJob-2.js} +14 -15
- package/dist/esm/scripts/{removeJob-3.js.map → removeJob-2.js.map} +1 -1
- package/dist/esm/scripts/removeUnprocessedChildren-2.js +10 -9
- package/dist/esm/scripts/removeUnprocessedChildren-2.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +1 -1
- /package/dist/esm/scripts/{removeJob-3.d.ts → removeJob-2.d.ts} +0 -0
@@ -21,7 +21,7 @@ local rcall = redis.call
|
|
21
21
|
local removeJobChildren
|
22
22
|
local removeJobWithChildren
|
23
23
|
|
24
|
-
removeJobChildren = function(prefix,
|
24
|
+
removeJobChildren = function(prefix, jobKey, options)
|
25
25
|
-- Check if this job has children
|
26
26
|
-- If so, we are going to try to remove the children recursively in a depth-first way
|
27
27
|
-- because if some job is locked, we must exit with an error.
|
@@ -32,7 +32,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
32
32
|
for i = 1, #processed, 2 do
|
33
33
|
local childJobId = getJobIdFromKey(processed[i])
|
34
34
|
local childJobPrefix = getJobKeyPrefix(processed[i], childJobId)
|
35
|
-
removeJobWithChildren(childJobPrefix,
|
35
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -41,7 +41,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
41
41
|
for i = 1, #failed, 2 do
|
42
42
|
local childJobId = getJobIdFromKey(failed[i])
|
43
43
|
local childJobPrefix = getJobKeyPrefix(failed[i], childJobId)
|
44
|
-
removeJobWithChildren(childJobPrefix,
|
44
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -50,7 +50,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
50
50
|
for i = 1, #unsuccessful, 1 do
|
51
51
|
local childJobId = getJobIdFromKey(unsuccessful[i])
|
52
52
|
local childJobPrefix = getJobKeyPrefix(unsuccessful[i], childJobId)
|
53
|
-
removeJobWithChildren(childJobPrefix,
|
53
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -60,12 +60,12 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
60
60
|
for i, childJobKey in ipairs(dependencies) do
|
61
61
|
local childJobId = getJobIdFromKey(childJobKey)
|
62
62
|
local childJobPrefix = getJobKeyPrefix(childJobKey, childJobId)
|
63
|
-
removeJobWithChildren(childJobPrefix,
|
63
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
removeJobWithChildren = function(prefix,
|
68
|
+
removeJobWithChildren = function(prefix, jobId, parentKey, options)
|
69
69
|
local jobKey = prefix .. jobId
|
70
70
|
|
71
71
|
if options.ignoreLocked then
|
@@ -80,13 +80,14 @@ removeJobWithChildren = function(prefix, meta, jobId, parentKey, options)
|
|
80
80
|
removeParentDependencyKey(jobKey, false, parentKey, nil)
|
81
81
|
|
82
82
|
if options.removeChildren then
|
83
|
-
removeJobChildren(prefix,
|
83
|
+
removeJobChildren(prefix, jobKey, options)
|
84
84
|
end
|
85
85
|
|
86
86
|
local prev = removeJobFromAnyState(prefix, jobId)
|
87
87
|
removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
|
88
88
|
if removeJobKeys(jobKey) > 0 then
|
89
|
-
local
|
89
|
+
local metaKey = prefix .. "meta"
|
90
|
+
local maxEvents = getOrSetMaxEvents(metaKey)
|
90
91
|
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
91
92
|
"jobId", jobId, "prev", prev)
|
92
93
|
end
|
@@ -4,8 +4,7 @@
|
|
4
4
|
|
5
5
|
Input:
|
6
6
|
KEYS[1] jobKey
|
7
|
-
KEYS[2]
|
8
|
-
KEYS[3] repeat key
|
7
|
+
KEYS[2] repeat key
|
9
8
|
|
10
9
|
ARGV[1] jobId
|
11
10
|
ARGV[2] remove children
|
@@ -26,8 +25,7 @@ local jobId = ARGV[1]
|
|
26
25
|
local shouldRemoveChildren = ARGV[2]
|
27
26
|
local prefix = ARGV[3]
|
28
27
|
local jobKey = KEYS[1]
|
29
|
-
local
|
30
|
-
local repeatKey = KEYS[3]
|
28
|
+
local repeatKey = KEYS[2]
|
31
29
|
|
32
30
|
if isJobSchedulerJob(jobId, jobKey, repeatKey) then
|
33
31
|
return -8
|
@@ -40,7 +38,7 @@ if not isLocked(prefix, jobId, shouldRemoveChildren) then
|
|
40
38
|
ignoreLocked = false
|
41
39
|
}
|
42
40
|
|
43
|
-
removeJobWithChildren(prefix,
|
41
|
+
removeJobWithChildren(prefix, jobId, nil, options)
|
44
42
|
return 1
|
45
43
|
end
|
46
44
|
return 0
|
@@ -35,7 +35,7 @@ export * from './pause-7';
|
|
35
35
|
export * from './promote-9';
|
36
36
|
export * from './releaseLock-1';
|
37
37
|
export * from './removeChildDependency-1';
|
38
|
-
export * from './removeJob-
|
38
|
+
export * from './removeJob-2';
|
39
39
|
export * from './removeJobScheduler-3';
|
40
40
|
export * from './removeRepeatable-3';
|
41
41
|
export * from './removeUnprocessedChildren-2';
|
@@ -35,7 +35,7 @@ export * from './pause-7';
|
|
35
35
|
export * from './promote-9';
|
36
36
|
export * from './releaseLock-1';
|
37
37
|
export * from './removeChildDependency-1';
|
38
|
-
export * from './removeJob-
|
38
|
+
export * from './removeJob-2';
|
39
39
|
export * from './removeJobScheduler-3';
|
40
40
|
export * from './removeRepeatable-3';
|
41
41
|
export * from './removeUnprocessedChildren-2';
|
@@ -3,8 +3,7 @@ const content = `--[[
|
|
3
3
|
In order to be able to remove a job, it cannot be active.
|
4
4
|
Input:
|
5
5
|
KEYS[1] jobKey
|
6
|
-
KEYS[2]
|
7
|
-
KEYS[3] repeat key
|
6
|
+
KEYS[2] repeat key
|
8
7
|
ARGV[1] jobId
|
9
8
|
ARGV[2] remove children
|
10
9
|
ARGV[3] queue prefix
|
@@ -257,7 +256,7 @@ local function removeParentDependencyKey(jobKey, hard, parentKey, baseKey, debou
|
|
257
256
|
end
|
258
257
|
local removeJobChildren
|
259
258
|
local removeJobWithChildren
|
260
|
-
removeJobChildren = function(prefix,
|
259
|
+
removeJobChildren = function(prefix, jobKey, options)
|
261
260
|
-- Check if this job has children
|
262
261
|
-- If so, we are going to try to remove the children recursively in a depth-first way
|
263
262
|
-- because if some job is locked, we must exit with an error.
|
@@ -267,7 +266,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
267
266
|
for i = 1, #processed, 2 do
|
268
267
|
local childJobId = getJobIdFromKey(processed[i])
|
269
268
|
local childJobPrefix = getJobKeyPrefix(processed[i], childJobId)
|
270
|
-
removeJobWithChildren(childJobPrefix,
|
269
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
271
270
|
end
|
272
271
|
end
|
273
272
|
local failed = rcall("HGETALL", jobKey .. ":failed")
|
@@ -275,7 +274,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
275
274
|
for i = 1, #failed, 2 do
|
276
275
|
local childJobId = getJobIdFromKey(failed[i])
|
277
276
|
local childJobPrefix = getJobKeyPrefix(failed[i], childJobId)
|
278
|
-
removeJobWithChildren(childJobPrefix,
|
277
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
279
278
|
end
|
280
279
|
end
|
281
280
|
local unsuccessful = rcall("ZRANGE", jobKey .. ":unsuccessful", 0, -1)
|
@@ -283,7 +282,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
283
282
|
for i = 1, #unsuccessful, 1 do
|
284
283
|
local childJobId = getJobIdFromKey(unsuccessful[i])
|
285
284
|
local childJobPrefix = getJobKeyPrefix(unsuccessful[i], childJobId)
|
286
|
-
removeJobWithChildren(childJobPrefix,
|
285
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
287
286
|
end
|
288
287
|
end
|
289
288
|
end
|
@@ -292,11 +291,11 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
292
291
|
for i, childJobKey in ipairs(dependencies) do
|
293
292
|
local childJobId = getJobIdFromKey(childJobKey)
|
294
293
|
local childJobPrefix = getJobKeyPrefix(childJobKey, childJobId)
|
295
|
-
removeJobWithChildren(childJobPrefix,
|
294
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
296
295
|
end
|
297
296
|
end
|
298
297
|
end
|
299
|
-
removeJobWithChildren = function(prefix,
|
298
|
+
removeJobWithChildren = function(prefix, jobId, parentKey, options)
|
300
299
|
local jobKey = prefix .. jobId
|
301
300
|
if options.ignoreLocked then
|
302
301
|
if isLocked(prefix, jobId) then
|
@@ -308,12 +307,13 @@ removeJobWithChildren = function(prefix, meta, jobId, parentKey, options)
|
|
308
307
|
if not (options.ignoreProcessed and rcall("ZSCORE", failedSet, jobId)) then
|
309
308
|
removeParentDependencyKey(jobKey, false, parentKey, nil)
|
310
309
|
if options.removeChildren then
|
311
|
-
removeJobChildren(prefix,
|
310
|
+
removeJobChildren(prefix, jobKey, options)
|
312
311
|
end
|
313
312
|
local prev = removeJobFromAnyState(prefix, jobId)
|
314
313
|
removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
|
315
314
|
if removeJobKeys(jobKey) > 0 then
|
316
|
-
local
|
315
|
+
local metaKey = prefix .. "meta"
|
316
|
+
local maxEvents = getOrSetMaxEvents(metaKey)
|
317
317
|
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
318
318
|
"jobId", jobId, "prev", prev)
|
319
319
|
end
|
@@ -323,8 +323,7 @@ local jobId = ARGV[1]
|
|
323
323
|
local shouldRemoveChildren = ARGV[2]
|
324
324
|
local prefix = ARGV[3]
|
325
325
|
local jobKey = KEYS[1]
|
326
|
-
local
|
327
|
-
local repeatKey = KEYS[3]
|
326
|
+
local repeatKey = KEYS[2]
|
328
327
|
if isJobSchedulerJob(jobId, jobKey, repeatKey) then
|
329
328
|
return -8
|
330
329
|
end
|
@@ -334,7 +333,7 @@ if not isLocked(prefix, jobId, shouldRemoveChildren) then
|
|
334
333
|
ignoreProcessed = false,
|
335
334
|
ignoreLocked = false
|
336
335
|
}
|
337
|
-
removeJobWithChildren(prefix,
|
336
|
+
removeJobWithChildren(prefix, jobId, nil, options)
|
338
337
|
return 1
|
339
338
|
end
|
340
339
|
return 0
|
@@ -342,6 +341,6 @@ return 0
|
|
342
341
|
export const removeJob = {
|
343
342
|
name: 'removeJob',
|
344
343
|
content,
|
345
|
-
keys:
|
344
|
+
keys: 2,
|
346
345
|
};
|
347
|
-
//# sourceMappingURL=removeJob-
|
346
|
+
//# sourceMappingURL=removeJob-2.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"removeJob-
|
1
|
+
{"version":3,"file":"removeJob-2.js","sourceRoot":"","sources":["../../../src/scripts/removeJob-2.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmVf,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,WAAW;IACjB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -254,7 +254,7 @@ local function isLocked( prefix, jobId, removeChildren)
|
|
254
254
|
end
|
255
255
|
local removeJobChildren
|
256
256
|
local removeJobWithChildren
|
257
|
-
removeJobChildren = function(prefix,
|
257
|
+
removeJobChildren = function(prefix, jobKey, options)
|
258
258
|
-- Check if this job has children
|
259
259
|
-- If so, we are going to try to remove the children recursively in a depth-first way
|
260
260
|
-- because if some job is locked, we must exit with an error.
|
@@ -264,7 +264,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
264
264
|
for i = 1, #processed, 2 do
|
265
265
|
local childJobId = getJobIdFromKey(processed[i])
|
266
266
|
local childJobPrefix = getJobKeyPrefix(processed[i], childJobId)
|
267
|
-
removeJobWithChildren(childJobPrefix,
|
267
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
268
268
|
end
|
269
269
|
end
|
270
270
|
local failed = rcall("HGETALL", jobKey .. ":failed")
|
@@ -272,7 +272,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
272
272
|
for i = 1, #failed, 2 do
|
273
273
|
local childJobId = getJobIdFromKey(failed[i])
|
274
274
|
local childJobPrefix = getJobKeyPrefix(failed[i], childJobId)
|
275
|
-
removeJobWithChildren(childJobPrefix,
|
275
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
276
276
|
end
|
277
277
|
end
|
278
278
|
local unsuccessful = rcall("ZRANGE", jobKey .. ":unsuccessful", 0, -1)
|
@@ -280,7 +280,7 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
280
280
|
for i = 1, #unsuccessful, 1 do
|
281
281
|
local childJobId = getJobIdFromKey(unsuccessful[i])
|
282
282
|
local childJobPrefix = getJobKeyPrefix(unsuccessful[i], childJobId)
|
283
|
-
removeJobWithChildren(childJobPrefix,
|
283
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
284
284
|
end
|
285
285
|
end
|
286
286
|
end
|
@@ -289,11 +289,11 @@ removeJobChildren = function(prefix, meta, jobKey, options)
|
|
289
289
|
for i, childJobKey in ipairs(dependencies) do
|
290
290
|
local childJobId = getJobIdFromKey(childJobKey)
|
291
291
|
local childJobPrefix = getJobKeyPrefix(childJobKey, childJobId)
|
292
|
-
removeJobWithChildren(childJobPrefix,
|
292
|
+
removeJobWithChildren(childJobPrefix, childJobId, jobKey, options)
|
293
293
|
end
|
294
294
|
end
|
295
295
|
end
|
296
|
-
removeJobWithChildren = function(prefix,
|
296
|
+
removeJobWithChildren = function(prefix, jobId, parentKey, options)
|
297
297
|
local jobKey = prefix .. jobId
|
298
298
|
if options.ignoreLocked then
|
299
299
|
if isLocked(prefix, jobId) then
|
@@ -305,12 +305,13 @@ removeJobWithChildren = function(prefix, meta, jobId, parentKey, options)
|
|
305
305
|
if not (options.ignoreProcessed and rcall("ZSCORE", failedSet, jobId)) then
|
306
306
|
removeParentDependencyKey(jobKey, false, parentKey, nil)
|
307
307
|
if options.removeChildren then
|
308
|
-
removeJobChildren(prefix,
|
308
|
+
removeJobChildren(prefix, jobKey, options)
|
309
309
|
end
|
310
310
|
local prev = removeJobFromAnyState(prefix, jobId)
|
311
311
|
removeDeduplicationKeyIfNeededOnRemoval(prefix, jobKey, jobId)
|
312
312
|
if removeJobKeys(jobKey) > 0 then
|
313
|
-
local
|
313
|
+
local metaKey = prefix .. "meta"
|
314
|
+
local maxEvents = getOrSetMaxEvents(metaKey)
|
314
315
|
rcall("XADD", prefix .. "events", "MAXLEN", "~", maxEvents, "*", "event", "removed",
|
315
316
|
"jobId", jobId, "prev", prev)
|
316
317
|
end
|
@@ -325,7 +326,7 @@ local options = {
|
|
325
326
|
ignoreProcessed = true,
|
326
327
|
ignoreLocked = true
|
327
328
|
}
|
328
|
-
removeJobChildren(prefix,
|
329
|
+
removeJobChildren(prefix, jobKey, options)
|
329
330
|
`;
|
330
331
|
export const removeUnprocessedChildren = {
|
331
332
|
name: 'removeUnprocessedChildren',
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyUf,CAAC;AACF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,IAAI,EAAE,2BAA2B;IACjC,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|