bullmq 5.44.4 → 5.45.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/queue-events.js.map +1 -1
- package/dist/cjs/commands/includes/deduplicateJob.lua +16 -17
- package/dist/cjs/commands/updateJobScheduler-12.lua +28 -22
- package/dist/cjs/scripts/addDelayedJob-6.js +16 -16
- package/dist/cjs/scripts/addParentJob-4.js +16 -16
- package/dist/cjs/scripts/addPrioritizedJob-8.js +16 -16
- package/dist/cjs/scripts/addStandardJob-8.js +16 -16
- package/dist/cjs/scripts/updateJobScheduler-12.js +25 -19
- package/dist/cjs/scripts/updateJobScheduler-12.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/queue-events.d.ts +113 -26
- package/dist/esm/classes/queue-events.js.map +1 -1
- package/dist/esm/commands/includes/deduplicateJob.lua +16 -17
- package/dist/esm/commands/updateJobScheduler-12.lua +28 -22
- package/dist/esm/scripts/addDelayedJob-6.js +16 -16
- package/dist/esm/scripts/addParentJob-4.js +16 -16
- package/dist/esm/scripts/addPrioritizedJob-8.js +16 -16
- package/dist/esm/scripts/addStandardJob-8.js +16 -16
- package/dist/esm/scripts/updateJobScheduler-12.js +25 -19
- package/dist/esm/scripts/updateJobScheduler-12.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 +21 -16
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queue-events.js","sourceRoot":"","sources":["../../../src/classes/queue-events.ts"],"names":[],"mappings":";;;;AAMA,oCAKkB;AAClB,6CAAyC;
|
1
|
+
{"version":3,"file":"queue-events.js","sourceRoot":"","sources":["../../../src/classes/queue-events.ts"],"names":[],"mappings":";;;;AAMA,oCAKkB;AAClB,6CAAyC;AAgQzC;;;;;;GAMG;AACH,MAA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QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF;AAvJD,kCAuJC"}
|
@@ -1,24 +1,23 @@
|
|
1
1
|
--[[
|
2
2
|
Function to debounce a job.
|
3
|
-
]]
|
4
|
-
|
3
|
+
]]
|
5
4
|
local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
|
6
5
|
local deduplicationId = deduplicationOpts and deduplicationOpts['id']
|
7
6
|
if deduplicationId then
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
7
|
+
local ttl = deduplicationOpts['ttl']
|
8
|
+
local deduplicationKeyExists
|
9
|
+
if ttl then
|
10
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
|
11
|
+
else
|
12
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
|
13
|
+
end
|
14
|
+
if deduplicationKeyExists then
|
15
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
16
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
|
17
|
+
"debounceId", deduplicationId)
|
18
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
19
|
+
currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
|
20
|
+
return currentDebounceJobId
|
21
|
+
end
|
23
22
|
end
|
24
23
|
end
|
@@ -25,7 +25,8 @@
|
|
25
25
|
|
26
26
|
Output:
|
27
27
|
next delayed job id - OK
|
28
|
-
]]
|
28
|
+
]]
|
29
|
+
local rcall = redis.call
|
29
30
|
local repeatKey = KEYS[1]
|
30
31
|
local delayedKey = KEYS[2]
|
31
32
|
local waitKey = KEYS[3]
|
@@ -51,34 +52,39 @@ local prevMillis = rcall("ZSCORE", repeatKey, jobSchedulerId)
|
|
51
52
|
if prevMillis ~= false then
|
52
53
|
local currentDelayedJobId = "repeat:" .. jobSchedulerId .. ":" .. prevMillis
|
53
54
|
|
54
|
-
if producerId == currentDelayedJobId
|
55
|
-
local schedulerAttributes = rcall("HMGET", schedulerKey, "name", "data")
|
56
|
-
|
57
|
-
rcall("ZADD", repeatKey, nextMillis, jobSchedulerId)
|
58
|
-
rcall("HINCRBY", schedulerKey, "ic", 1)
|
59
|
-
|
55
|
+
if producerId == currentDelayedJobId then
|
60
56
|
local eventsKey = KEYS[9]
|
61
57
|
local maxEvents = getOrSetMaxEvents(metaKey)
|
62
58
|
|
63
|
-
rcall("
|
59
|
+
if rcall("EXISTS", nextDelayedJobKey) ~= 1 then
|
60
|
+
local schedulerAttributes = rcall("HMGET", schedulerKey, "name", "data")
|
64
61
|
|
65
|
-
|
66
|
-
|
67
|
-
local templateData = schedulerAttributes[2] or ARGV[3]
|
62
|
+
rcall("ZADD", repeatKey, nextMillis, jobSchedulerId)
|
63
|
+
rcall("HINCRBY", schedulerKey, "ic", 1)
|
68
64
|
|
69
|
-
|
70
|
-
rcall("HSET", schedulerKey, "data", templateData)
|
71
|
-
end
|
65
|
+
rcall("INCR", KEYS[8])
|
72
66
|
|
73
|
-
|
74
|
-
|
75
|
-
schedulerAttributes[
|
67
|
+
-- TODO: remove this workaround in next breaking change,
|
68
|
+
-- all job-schedulers must save job data
|
69
|
+
local templateData = schedulerAttributes[2] or ARGV[3]
|
76
70
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
end
|
71
|
+
if templateData and templateData ~= '{}' then
|
72
|
+
rcall("HSET", schedulerKey, "data", templateData)
|
73
|
+
end
|
81
74
|
|
82
|
-
|
75
|
+
addJobFromScheduler(nextDelayedJobKey, nextDelayedJobId, ARGV[4], waitKey, pausedKey,
|
76
|
+
KEYS[12], metaKey, prioritizedKey, KEYS[10], delayedKey, KEYS[7], eventsKey,
|
77
|
+
schedulerAttributes[1], maxEvents, ARGV[5], templateData or '{}', jobSchedulerId)
|
78
|
+
|
79
|
+
-- TODO: remove this workaround in next breaking change
|
80
|
+
if KEYS[11] ~= "" then
|
81
|
+
rcall("HSET", KEYS[11], "nrjid", nextDelayedJobId)
|
82
|
+
end
|
83
|
+
|
84
|
+
return nextDelayedJobId .. "" -- convert to string
|
85
|
+
else
|
86
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
|
87
|
+
"duplicated", "jobId", nextDelayedJobId)
|
88
|
+
end
|
83
89
|
end
|
84
90
|
end
|
@@ -114,25 +114,25 @@ local function addDelayedJob(jobId, delayedKey, eventsKey, timestamp,
|
|
114
114
|
end
|
115
115
|
--[[
|
116
116
|
Function to debounce a job.
|
117
|
-
]]
|
117
|
+
]]
|
118
118
|
local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
|
119
119
|
local deduplicationId = deduplicationOpts and deduplicationOpts['id']
|
120
120
|
if deduplicationId then
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
121
|
+
local ttl = deduplicationOpts['ttl']
|
122
|
+
local deduplicationKeyExists
|
123
|
+
if ttl then
|
124
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
|
125
|
+
else
|
126
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
|
127
|
+
end
|
128
|
+
if deduplicationKeyExists then
|
129
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
130
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
|
131
|
+
"debounceId", deduplicationId)
|
132
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
133
|
+
currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
|
134
|
+
return currentDebounceJobId
|
135
|
+
end
|
136
136
|
end
|
137
137
|
end
|
138
138
|
--[[
|
@@ -46,25 +46,25 @@ local parentData
|
|
46
46
|
-- Includes
|
47
47
|
--[[
|
48
48
|
Function to debounce a job.
|
49
|
-
]]
|
49
|
+
]]
|
50
50
|
local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
|
51
51
|
local deduplicationId = deduplicationOpts and deduplicationOpts['id']
|
52
52
|
if deduplicationId then
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
53
|
+
local ttl = deduplicationOpts['ttl']
|
54
|
+
local deduplicationKeyExists
|
55
|
+
if ttl then
|
56
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
|
57
|
+
else
|
58
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
|
59
|
+
end
|
60
|
+
if deduplicationKeyExists then
|
61
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
62
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
|
63
|
+
"debounceId", deduplicationId)
|
64
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
65
|
+
currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
|
66
|
+
return currentDebounceJobId
|
67
|
+
end
|
68
68
|
end
|
69
69
|
end
|
70
70
|
--[[
|
@@ -78,25 +78,25 @@ local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, pr
|
|
78
78
|
end
|
79
79
|
--[[
|
80
80
|
Function to debounce a job.
|
81
|
-
]]
|
81
|
+
]]
|
82
82
|
local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
|
83
83
|
local deduplicationId = deduplicationOpts and deduplicationOpts['id']
|
84
84
|
if deduplicationId then
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
85
|
+
local ttl = deduplicationOpts['ttl']
|
86
|
+
local deduplicationKeyExists
|
87
|
+
if ttl then
|
88
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
|
89
|
+
else
|
90
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
|
91
|
+
end
|
92
|
+
if deduplicationKeyExists then
|
93
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
94
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
|
95
|
+
"debounceId", deduplicationId)
|
96
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
97
|
+
currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
|
98
|
+
return currentDebounceJobId
|
99
|
+
end
|
100
100
|
end
|
101
101
|
end
|
102
102
|
--[[
|
@@ -72,25 +72,25 @@ local function addJobInTargetList(targetKey, markerKey, pushCmd, isPausedOrMaxed
|
|
72
72
|
end
|
73
73
|
--[[
|
74
74
|
Function to debounce a job.
|
75
|
-
]]
|
75
|
+
]]
|
76
76
|
local function deduplicateJob(deduplicationOpts, jobId, deduplicationKey, eventsKey, maxEvents)
|
77
77
|
local deduplicationId = deduplicationOpts and deduplicationOpts['id']
|
78
78
|
if deduplicationId then
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
79
|
+
local ttl = deduplicationOpts['ttl']
|
80
|
+
local deduplicationKeyExists
|
81
|
+
if ttl then
|
82
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'PX', ttl, 'NX')
|
83
|
+
else
|
84
|
+
deduplicationKeyExists = not rcall('SET', deduplicationKey, jobId, 'NX')
|
85
|
+
end
|
86
|
+
if deduplicationKeyExists then
|
87
|
+
local currentDebounceJobId = rcall('GET', deduplicationKey)
|
88
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "debounced", "jobId", currentDebounceJobId,
|
89
|
+
"debounceId", deduplicationId)
|
90
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event", "deduplicated", "jobId",
|
91
|
+
currentDebounceJobId, "deduplicationId", deduplicationId, "deduplicatedJobId", jobId)
|
92
|
+
return currentDebounceJobId
|
93
|
+
end
|
94
94
|
end
|
95
95
|
end
|
96
96
|
--[[
|
@@ -25,7 +25,8 @@ const content = `--[[
|
|
25
25
|
ARGV[7] producer id
|
26
26
|
Output:
|
27
27
|
next delayed job id - OK
|
28
|
-
]]
|
28
|
+
]]
|
29
|
+
local rcall = redis.call
|
29
30
|
local repeatKey = KEYS[1]
|
30
31
|
local delayedKey = KEYS[2]
|
31
32
|
local waitKey = KEYS[3]
|
@@ -236,27 +237,32 @@ local nextDelayedJobKey = schedulerKey .. ":" .. nextMillis
|
|
236
237
|
local prevMillis = rcall("ZSCORE", repeatKey, jobSchedulerId)
|
237
238
|
if prevMillis ~= false then
|
238
239
|
local currentDelayedJobId = "repeat:" .. jobSchedulerId .. ":" .. prevMillis
|
239
|
-
if producerId == currentDelayedJobId
|
240
|
-
local schedulerAttributes = rcall("HMGET", schedulerKey, "name", "data")
|
241
|
-
rcall("ZADD", repeatKey, nextMillis, jobSchedulerId)
|
242
|
-
rcall("HINCRBY", schedulerKey, "ic", 1)
|
240
|
+
if producerId == currentDelayedJobId then
|
243
241
|
local eventsKey = KEYS[9]
|
244
242
|
local maxEvents = getOrSetMaxEvents(metaKey)
|
245
|
-
rcall("
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
243
|
+
if rcall("EXISTS", nextDelayedJobKey) ~= 1 then
|
244
|
+
local schedulerAttributes = rcall("HMGET", schedulerKey, "name", "data")
|
245
|
+
rcall("ZADD", repeatKey, nextMillis, jobSchedulerId)
|
246
|
+
rcall("HINCRBY", schedulerKey, "ic", 1)
|
247
|
+
rcall("INCR", KEYS[8])
|
248
|
+
-- TODO: remove this workaround in next breaking change,
|
249
|
+
-- all job-schedulers must save job data
|
250
|
+
local templateData = schedulerAttributes[2] or ARGV[3]
|
251
|
+
if templateData and templateData ~= '{}' then
|
252
|
+
rcall("HSET", schedulerKey, "data", templateData)
|
253
|
+
end
|
254
|
+
addJobFromScheduler(nextDelayedJobKey, nextDelayedJobId, ARGV[4], waitKey, pausedKey,
|
255
|
+
KEYS[12], metaKey, prioritizedKey, KEYS[10], delayedKey, KEYS[7], eventsKey,
|
256
|
+
schedulerAttributes[1], maxEvents, ARGV[5], templateData or '{}', jobSchedulerId)
|
257
|
+
-- TODO: remove this workaround in next breaking change
|
258
|
+
if KEYS[11] ~= "" then
|
259
|
+
rcall("HSET", KEYS[11], "nrjid", nextDelayedJobId)
|
260
|
+
end
|
261
|
+
return nextDelayedJobId .. "" -- convert to string
|
262
|
+
else
|
263
|
+
rcall("XADD", eventsKey, "MAXLEN", "~", maxEvents, "*", "event",
|
264
|
+
"duplicated", "jobId", nextDelayedJobId)
|
258
265
|
end
|
259
|
-
return nextDelayedJobId .. "" -- convert to string
|
260
266
|
end
|
261
267
|
end
|
262
268
|
`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"updateJobScheduler-12.js","sourceRoot":"","sources":["../../../src/scripts/updateJobScheduler-12.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"updateJobScheduler-12.js","sourceRoot":"","sources":["../../../src/scripts/updateJobScheduler-12.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwQf,CAAC;AACW,QAAA,kBAAkB,GAAG;IAChC,IAAI,EAAE,oBAAoB;IAC1B,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|