bullmq 5.1.4 → 5.1.5
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/commands/includes/prepareJobForProcessing.lua +3 -39
- package/dist/cjs/commands/moveToActive-11.lua +6 -5
- package/dist/cjs/commands/moveToFinished-14.lua +12 -11
- package/dist/cjs/scripts/moveToActive-11.js +9 -43
- package/dist/cjs/scripts/moveToActive-11.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-14.js +15 -49
- package/dist/cjs/scripts/moveToFinished-14.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/esm/commands/includes/prepareJobForProcessing.lua +3 -39
- package/dist/esm/commands/moveToActive-11.lua +6 -5
- package/dist/esm/commands/moveToFinished-14.lua +12 -11
- package/dist/esm/scripts/moveToActive-11.js +9 -43
- package/dist/esm/scripts/moveToActive-11.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-14.js +15 -49
- package/dist/esm/scripts/moveToFinished-14.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
@@ -2,53 +2,17 @@
|
|
2
2
|
--[[
|
3
3
|
Function to move job from wait state to active.
|
4
4
|
Input:
|
5
|
-
keys[1] wait key
|
6
|
-
keys[2] active key
|
7
|
-
keys[3] prioritized key
|
8
|
-
keys[4] stream events key
|
9
|
-
keys[5] stalled key
|
10
|
-
|
11
|
-
-- Rate limiting
|
12
|
-
keys[6] rate limiter key
|
13
|
-
keys[7] delayed key
|
14
|
-
|
15
|
-
keys[8] paused key
|
16
|
-
keys[9] meta key
|
17
|
-
keys[10] pc priority counter
|
18
|
-
|
19
5
|
opts - token - lock token
|
20
6
|
opts - lockDuration
|
21
7
|
opts - limiter
|
22
8
|
]]
|
23
9
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
local function prepareJobForProcessing(keys, keyPrefix, targetKey, jobId, processedOn,
|
28
|
-
maxJobs, expireTime, opts)
|
10
|
+
local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey,
|
11
|
+
jobId, processedOn, maxJobs, opts)
|
29
12
|
local jobKey = keyPrefix .. jobId
|
30
13
|
|
31
14
|
-- Check if we need to perform rate limiting.
|
32
15
|
if maxJobs then
|
33
|
-
local rateLimiterKey = keys[6];
|
34
|
-
|
35
|
-
-- check if we exceeded rate limit, we need to remove the job and return expireTime
|
36
|
-
if expireTime > 0 then
|
37
|
-
-- remove from active queue and add back to the wait list
|
38
|
-
rcall("LREM", keys[2], 1, jobId)
|
39
|
-
|
40
|
-
local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
|
41
|
-
|
42
|
-
if priority == 0 then
|
43
|
-
rcall("RPUSH", targetKey, jobId)
|
44
|
-
else
|
45
|
-
pushBackJobWithPriority(keys[3], priority, jobId)
|
46
|
-
end
|
47
|
-
|
48
|
-
-- Return when we can process more jobs
|
49
|
-
return {0, 0, expireTime, 0}
|
50
|
-
end
|
51
|
-
|
52
16
|
local jobCounter = tonumber(rcall("INCR", rateLimiterKey))
|
53
17
|
|
54
18
|
if jobCounter == 1 then
|
@@ -65,7 +29,7 @@ local function prepareJobForProcessing(keys, keyPrefix, targetKey, jobId, proces
|
|
65
29
|
rcall("SET", lockKey, opts['token'], "PX", opts['lockDuration'])
|
66
30
|
end
|
67
31
|
|
68
|
-
rcall("XADD",
|
32
|
+
rcall("XADD", eventStreamKey, "*", "event", "active", "jobId", jobId, "prev", "waiting")
|
69
33
|
rcall("HSET", jobKey, "processedOn", processedOn)
|
70
34
|
rcall("HINCRBY", jobKey, "ats", 1)
|
71
35
|
|
@@ -37,6 +37,7 @@
|
|
37
37
|
local rcall = redis.call
|
38
38
|
local waitKey = KEYS[1]
|
39
39
|
local activeKey = KEYS[2]
|
40
|
+
local eventStreamKey = KEYS[4]
|
40
41
|
local rateLimiterKey = KEYS[6]
|
41
42
|
local delayedKey = KEYS[7]
|
42
43
|
local opts = cmsgpack.unpack(ARGV[3])
|
@@ -53,7 +54,7 @@ local target, paused = getTargetQueueList(KEYS[9], waitKey, KEYS[8])
|
|
53
54
|
|
54
55
|
-- Check if there are delayed jobs that we can move to wait.
|
55
56
|
local markerKey = KEYS[11]
|
56
|
-
promoteDelayedJobs(delayedKey, markerKey, target, KEYS[3],
|
57
|
+
promoteDelayedJobs(delayedKey, markerKey, target, KEYS[3], eventStreamKey, ARGV[1],
|
57
58
|
ARGV[2], KEYS[10], paused)
|
58
59
|
|
59
60
|
local maxJobs = tonumber(opts['limiter'] and opts['limiter']['max'])
|
@@ -75,13 +76,13 @@ if jobId and string.sub(jobId, 1, 2) == "0:" then
|
|
75
76
|
end
|
76
77
|
|
77
78
|
if jobId then
|
78
|
-
return prepareJobForProcessing(
|
79
|
-
maxJobs,
|
79
|
+
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
80
|
+
maxJobs, opts)
|
80
81
|
else
|
81
82
|
jobId = moveJobFromPriorityToActive(KEYS[3], activeKey, KEYS[10])
|
82
83
|
if jobId then
|
83
|
-
return prepareJobForProcessing(
|
84
|
-
maxJobs,
|
84
|
+
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
85
|
+
maxJobs, opts)
|
85
86
|
end
|
86
87
|
end
|
87
88
|
|
@@ -119,9 +119,10 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
119
119
|
|
120
120
|
if (numRemovedElements < 1) then return -3 end
|
121
121
|
|
122
|
+
local eventStreamKey = KEYS[4]
|
122
123
|
local metaKey = KEYS[9]
|
123
124
|
-- Trim events before emiting them to avoid trimming events emitted in this script
|
124
|
-
trimEvents(metaKey,
|
125
|
+
trimEvents(metaKey, eventStreamKey)
|
125
126
|
|
126
127
|
-- If job has a parent we need to
|
127
128
|
-- 1) remove this job id from parents dependencies
|
@@ -183,12 +184,12 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
183
184
|
end
|
184
185
|
end
|
185
186
|
|
186
|
-
rcall("XADD",
|
187
|
+
rcall("XADD", eventStreamKey, "*", "event", ARGV[5], "jobId", jobId, ARGV[3],
|
187
188
|
ARGV[4])
|
188
189
|
|
189
190
|
if ARGV[5] == "failed" then
|
190
191
|
if tonumber(attemptsMade) >= tonumber(attempts) then
|
191
|
-
rcall("XADD",
|
192
|
+
rcall("XADD", eventStreamKey, "*", "event", "retries-exhausted", "jobId",
|
192
193
|
jobId, "attemptsMade", attemptsMade)
|
193
194
|
end
|
194
195
|
end
|
@@ -205,7 +206,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
205
206
|
local target, paused = getTargetQueueList(metaKey, KEYS[1], KEYS[8])
|
206
207
|
|
207
208
|
-- Check if there are delayed jobs that can be promoted
|
208
|
-
promoteDelayedJobs(KEYS[7], KEYS[14], target, KEYS[3],
|
209
|
+
promoteDelayedJobs(KEYS[7], KEYS[14], target, KEYS[3], eventStreamKey, ARGV[7],
|
209
210
|
timestamp, KEYS[10], paused)
|
210
211
|
|
211
212
|
local maxJobs = tonumber(opts['limiter'] and opts['limiter']['max'])
|
@@ -229,20 +230,20 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
229
230
|
if jobId == "0:0" then
|
230
231
|
jobId = moveJobFromPriorityToActive(KEYS[3], KEYS[2],
|
231
232
|
KEYS[10])
|
232
|
-
return prepareJobForProcessing(
|
233
|
+
return prepareJobForProcessing(ARGV[7], KEYS[6], eventStreamKey, jobId,
|
233
234
|
timestamp, maxJobs,
|
234
|
-
|
235
|
+
opts)
|
235
236
|
end
|
236
237
|
else
|
237
|
-
return prepareJobForProcessing(
|
238
|
-
timestamp, maxJobs,
|
238
|
+
return prepareJobForProcessing(ARGV[7], KEYS[6], eventStreamKey, jobId,
|
239
|
+
timestamp, maxJobs,
|
239
240
|
opts)
|
240
241
|
end
|
241
242
|
else
|
242
243
|
jobId = moveJobFromPriorityToActive(KEYS[3], KEYS[2], KEYS[10])
|
243
244
|
if jobId then
|
244
|
-
return prepareJobForProcessing(
|
245
|
-
timestamp, maxJobs,
|
245
|
+
return prepareJobForProcessing(ARGV[7], KEYS[6], eventStreamKey, jobId,
|
246
|
+
timestamp, maxJobs,
|
246
247
|
opts)
|
247
248
|
end
|
248
249
|
end
|
@@ -264,7 +265,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
264
265
|
local prioritizedLen = rcall("ZCARD", KEYS[3])
|
265
266
|
|
266
267
|
if prioritizedLen == 0 then
|
267
|
-
rcall("XADD",
|
268
|
+
rcall("XADD", eventStreamKey, "*", "event", "drained")
|
268
269
|
end
|
269
270
|
end
|
270
271
|
end
|
@@ -33,6 +33,7 @@ const content = `--[[
|
|
33
33
|
local rcall = redis.call
|
34
34
|
local waitKey = KEYS[1]
|
35
35
|
local activeKey = KEYS[2]
|
36
|
+
local eventStreamKey = KEYS[4]
|
36
37
|
local rateLimiterKey = KEYS[6]
|
37
38
|
local delayedKey = KEYS[7]
|
38
39
|
local opts = cmsgpack.unpack(ARGV[3])
|
@@ -91,50 +92,15 @@ end
|
|
91
92
|
--[[
|
92
93
|
Function to move job from wait state to active.
|
93
94
|
Input:
|
94
|
-
keys[1] wait key
|
95
|
-
keys[2] active key
|
96
|
-
keys[3] prioritized key
|
97
|
-
keys[4] stream events key
|
98
|
-
keys[5] stalled key
|
99
|
-
-- Rate limiting
|
100
|
-
keys[6] rate limiter key
|
101
|
-
keys[7] delayed key
|
102
|
-
keys[8] paused key
|
103
|
-
keys[9] meta key
|
104
|
-
keys[10] pc priority counter
|
105
95
|
opts - token - lock token
|
106
96
|
opts - lockDuration
|
107
97
|
opts - limiter
|
108
98
|
]]
|
109
|
-
|
110
|
-
|
111
|
-
Function to push back job considering priority in front of same prioritized jobs.
|
112
|
-
]]
|
113
|
-
local function pushBackJobWithPriority(prioritizedKey, priority, jobId)
|
114
|
-
-- in order to put it at front of same prioritized jobs
|
115
|
-
-- we consider prioritized counter as 0
|
116
|
-
local score = priority * 0x100000000
|
117
|
-
rcall("ZADD", prioritizedKey, score, jobId)
|
118
|
-
end
|
119
|
-
local function prepareJobForProcessing(keys, keyPrefix, targetKey, jobId, processedOn,
|
120
|
-
maxJobs, expireTime, opts)
|
99
|
+
local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey,
|
100
|
+
jobId, processedOn, maxJobs, opts)
|
121
101
|
local jobKey = keyPrefix .. jobId
|
122
102
|
-- Check if we need to perform rate limiting.
|
123
103
|
if maxJobs then
|
124
|
-
local rateLimiterKey = keys[6];
|
125
|
-
-- check if we exceeded rate limit, we need to remove the job and return expireTime
|
126
|
-
if expireTime > 0 then
|
127
|
-
-- remove from active queue and add back to the wait list
|
128
|
-
rcall("LREM", keys[2], 1, jobId)
|
129
|
-
local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
|
130
|
-
if priority == 0 then
|
131
|
-
rcall("RPUSH", targetKey, jobId)
|
132
|
-
else
|
133
|
-
pushBackJobWithPriority(keys[3], priority, jobId)
|
134
|
-
end
|
135
|
-
-- Return when we can process more jobs
|
136
|
-
return {0, 0, expireTime, 0}
|
137
|
-
end
|
138
104
|
local jobCounter = tonumber(rcall("INCR", rateLimiterKey))
|
139
105
|
if jobCounter == 1 then
|
140
106
|
local limiterDuration = opts['limiter'] and opts['limiter']['duration']
|
@@ -147,7 +113,7 @@ local function prepareJobForProcessing(keys, keyPrefix, targetKey, jobId, proces
|
|
147
113
|
if opts['token'] ~= "0" then
|
148
114
|
rcall("SET", lockKey, opts['token'], "PX", opts['lockDuration'])
|
149
115
|
end
|
150
|
-
rcall("XADD",
|
116
|
+
rcall("XADD", eventStreamKey, "*", "event", "active", "jobId", jobId, "prev", "waiting")
|
151
117
|
rcall("HSET", jobKey, "processedOn", processedOn)
|
152
118
|
rcall("HINCRBY", jobKey, "ats", 1)
|
153
119
|
return {rcall("HGETALL", jobKey), jobId, 0, 0} -- get job data
|
@@ -212,7 +178,7 @@ end
|
|
212
178
|
local target, paused = getTargetQueueList(KEYS[9], waitKey, KEYS[8])
|
213
179
|
-- Check if there are delayed jobs that we can move to wait.
|
214
180
|
local markerKey = KEYS[11]
|
215
|
-
promoteDelayedJobs(delayedKey, markerKey, target, KEYS[3],
|
181
|
+
promoteDelayedJobs(delayedKey, markerKey, target, KEYS[3], eventStreamKey, ARGV[1],
|
216
182
|
ARGV[2], KEYS[10], paused)
|
217
183
|
local maxJobs = tonumber(opts['limiter'] and opts['limiter']['max'])
|
218
184
|
local expireTime = getRateLimitTTL(maxJobs, rateLimiterKey)
|
@@ -228,13 +194,13 @@ if jobId and string.sub(jobId, 1, 2) == "0:" then
|
|
228
194
|
jobId = rcall("RPOPLPUSH", waitKey, activeKey)
|
229
195
|
end
|
230
196
|
if jobId then
|
231
|
-
return prepareJobForProcessing(
|
232
|
-
maxJobs,
|
197
|
+
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
198
|
+
maxJobs, opts)
|
233
199
|
else
|
234
200
|
jobId = moveJobFromPriorityToActive(KEYS[3], activeKey, KEYS[10])
|
235
201
|
if jobId then
|
236
|
-
return prepareJobForProcessing(
|
237
|
-
maxJobs,
|
202
|
+
return prepareJobForProcessing(ARGV[1], rateLimiterKey, eventStreamKey, jobId, ARGV[2],
|
203
|
+
maxJobs, opts)
|
238
204
|
end
|
239
205
|
end
|
240
206
|
-- Return the timestamp for the next delayed job if any.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveToActive-11.js","sourceRoot":"","sources":["../../../src/scripts/moveToActive-11.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveToActive-11.js","sourceRoot":"","sources":["../../../src/scripts/moveToActive-11.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Mf,CAAC;AACW,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|
@@ -142,50 +142,15 @@ end
|
|
142
142
|
--[[
|
143
143
|
Function to move job from wait state to active.
|
144
144
|
Input:
|
145
|
-
keys[1] wait key
|
146
|
-
keys[2] active key
|
147
|
-
keys[3] prioritized key
|
148
|
-
keys[4] stream events key
|
149
|
-
keys[5] stalled key
|
150
|
-
-- Rate limiting
|
151
|
-
keys[6] rate limiter key
|
152
|
-
keys[7] delayed key
|
153
|
-
keys[8] paused key
|
154
|
-
keys[9] meta key
|
155
|
-
keys[10] pc priority counter
|
156
145
|
opts - token - lock token
|
157
146
|
opts - lockDuration
|
158
147
|
opts - limiter
|
159
148
|
]]
|
160
|
-
|
161
|
-
|
162
|
-
Function to push back job considering priority in front of same prioritized jobs.
|
163
|
-
]]
|
164
|
-
local function pushBackJobWithPriority(prioritizedKey, priority, jobId)
|
165
|
-
-- in order to put it at front of same prioritized jobs
|
166
|
-
-- we consider prioritized counter as 0
|
167
|
-
local score = priority * 0x100000000
|
168
|
-
rcall("ZADD", prioritizedKey, score, jobId)
|
169
|
-
end
|
170
|
-
local function prepareJobForProcessing(keys, keyPrefix, targetKey, jobId, processedOn,
|
171
|
-
maxJobs, expireTime, opts)
|
149
|
+
local function prepareJobForProcessing(keyPrefix, rateLimiterKey, eventStreamKey,
|
150
|
+
jobId, processedOn, maxJobs, opts)
|
172
151
|
local jobKey = keyPrefix .. jobId
|
173
152
|
-- Check if we need to perform rate limiting.
|
174
153
|
if maxJobs then
|
175
|
-
local rateLimiterKey = keys[6];
|
176
|
-
-- check if we exceeded rate limit, we need to remove the job and return expireTime
|
177
|
-
if expireTime > 0 then
|
178
|
-
-- remove from active queue and add back to the wait list
|
179
|
-
rcall("LREM", keys[2], 1, jobId)
|
180
|
-
local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
|
181
|
-
if priority == 0 then
|
182
|
-
rcall("RPUSH", targetKey, jobId)
|
183
|
-
else
|
184
|
-
pushBackJobWithPriority(keys[3], priority, jobId)
|
185
|
-
end
|
186
|
-
-- Return when we can process more jobs
|
187
|
-
return {0, 0, expireTime, 0}
|
188
|
-
end
|
189
154
|
local jobCounter = tonumber(rcall("INCR", rateLimiterKey))
|
190
155
|
if jobCounter == 1 then
|
191
156
|
local limiterDuration = opts['limiter'] and opts['limiter']['duration']
|
@@ -198,7 +163,7 @@ local function prepareJobForProcessing(keys, keyPrefix, targetKey, jobId, proces
|
|
198
163
|
if opts['token'] ~= "0" then
|
199
164
|
rcall("SET", lockKey, opts['token'], "PX", opts['lockDuration'])
|
200
165
|
end
|
201
|
-
rcall("XADD",
|
166
|
+
rcall("XADD", eventStreamKey, "*", "event", "active", "jobId", jobId, "prev", "waiting")
|
202
167
|
rcall("HSET", jobKey, "processedOn", processedOn)
|
203
168
|
rcall("HINCRBY", jobKey, "ats", 1)
|
204
169
|
return {rcall("HGETALL", jobKey), jobId, 0, 0} -- get job data
|
@@ -554,9 +519,10 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
554
519
|
-- Remove from active list (if not active we shall return error)
|
555
520
|
local numRemovedElements = rcall("LREM", KEYS[2], -1, jobId)
|
556
521
|
if (numRemovedElements < 1) then return -3 end
|
522
|
+
local eventStreamKey = KEYS[4]
|
557
523
|
local metaKey = KEYS[9]
|
558
524
|
-- Trim events before emiting them to avoid trimming events emitted in this script
|
559
|
-
trimEvents(metaKey,
|
525
|
+
trimEvents(metaKey, eventStreamKey)
|
560
526
|
-- If job has a parent we need to
|
561
527
|
-- 1) remove this job id from parents dependencies
|
562
528
|
-- 2) move the job Id to parent "processed" set
|
@@ -610,11 +576,11 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
610
576
|
removeParentDependencyKey(jobIdKey, false, parentKey)
|
611
577
|
end
|
612
578
|
end
|
613
|
-
rcall("XADD",
|
579
|
+
rcall("XADD", eventStreamKey, "*", "event", ARGV[5], "jobId", jobId, ARGV[3],
|
614
580
|
ARGV[4])
|
615
581
|
if ARGV[5] == "failed" then
|
616
582
|
if tonumber(attemptsMade) >= tonumber(attempts) then
|
617
|
-
rcall("XADD",
|
583
|
+
rcall("XADD", eventStreamKey, "*", "event", "retries-exhausted", "jobId",
|
618
584
|
jobId, "attemptsMade", attemptsMade)
|
619
585
|
end
|
620
586
|
end
|
@@ -627,7 +593,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
627
593
|
if (ARGV[6] == "1") then
|
628
594
|
local target, paused = getTargetQueueList(metaKey, KEYS[1], KEYS[8])
|
629
595
|
-- Check if there are delayed jobs that can be promoted
|
630
|
-
promoteDelayedJobs(KEYS[7], KEYS[14], target, KEYS[3],
|
596
|
+
promoteDelayedJobs(KEYS[7], KEYS[14], target, KEYS[3], eventStreamKey, ARGV[7],
|
631
597
|
timestamp, KEYS[10], paused)
|
632
598
|
local maxJobs = tonumber(opts['limiter'] and opts['limiter']['max'])
|
633
599
|
-- Check if we are rate limited first.
|
@@ -645,20 +611,20 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
645
611
|
if jobId == "0:0" then
|
646
612
|
jobId = moveJobFromPriorityToActive(KEYS[3], KEYS[2],
|
647
613
|
KEYS[10])
|
648
|
-
return prepareJobForProcessing(
|
614
|
+
return prepareJobForProcessing(ARGV[7], KEYS[6], eventStreamKey, jobId,
|
649
615
|
timestamp, maxJobs,
|
650
|
-
|
616
|
+
opts)
|
651
617
|
end
|
652
618
|
else
|
653
|
-
return prepareJobForProcessing(
|
654
|
-
timestamp, maxJobs,
|
619
|
+
return prepareJobForProcessing(ARGV[7], KEYS[6], eventStreamKey, jobId,
|
620
|
+
timestamp, maxJobs,
|
655
621
|
opts)
|
656
622
|
end
|
657
623
|
else
|
658
624
|
jobId = moveJobFromPriorityToActive(KEYS[3], KEYS[2], KEYS[10])
|
659
625
|
if jobId then
|
660
|
-
return prepareJobForProcessing(
|
661
|
-
timestamp, maxJobs,
|
626
|
+
return prepareJobForProcessing(ARGV[7], KEYS[6], eventStreamKey, jobId,
|
627
|
+
timestamp, maxJobs,
|
662
628
|
opts)
|
663
629
|
end
|
664
630
|
end
|
@@ -676,7 +642,7 @@ if rcall("EXISTS", jobIdKey) == 1 then -- // Make sure job exists
|
|
676
642
|
if activeLen == 0 then
|
677
643
|
local prioritizedLen = rcall("ZCARD", KEYS[3])
|
678
644
|
if prioritizedLen == 0 then
|
679
|
-
rcall("XADD",
|
645
|
+
rcall("XADD", eventStreamKey, "*", "event", "drained")
|
680
646
|
end
|
681
647
|
end
|
682
648
|
end
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyoBf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|