bullmq 4.18.2 → 4.18.3
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/addJobWithPriority.lua +2 -2
- package/dist/cjs/commands/includes/getPriorityScore.lua +7 -0
- package/dist/cjs/commands/includes/promoteDelayedJobs.lua +8 -3
- package/dist/cjs/scripts/addDelayedJob-7.js +8 -2
- package/dist/cjs/scripts/addDelayedJob-7.js.map +1 -1
- package/dist/cjs/scripts/addParentJob-4.js +8 -2
- package/dist/cjs/scripts/addParentJob-4.js.map +1 -1
- package/dist/cjs/scripts/addPrioritizedJob-8.js +8 -2
- package/dist/cjs/scripts/addPrioritizedJob-8.js.map +1 -1
- package/dist/cjs/scripts/addStandardJob-6.js +8 -2
- package/dist/cjs/scripts/addStandardJob-6.js.map +1 -1
- package/dist/cjs/scripts/changePriority-5.js +8 -2
- package/dist/cjs/scripts/changePriority-5.js.map +1 -1
- package/dist/cjs/scripts/moveToActive-10.js +10 -12
- package/dist/cjs/scripts/moveToActive-10.js.map +1 -1
- package/dist/cjs/scripts/moveToDelayed-8.js +10 -12
- package/dist/cjs/scripts/moveToDelayed-8.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-13.js +13 -4
- package/dist/cjs/scripts/moveToFinished-13.js.map +1 -1
- package/dist/cjs/scripts/promote-7.js +8 -2
- package/dist/cjs/scripts/promote-7.js.map +1 -1
- package/dist/cjs/scripts/retryJob-9.js +13 -4
- package/dist/cjs/scripts/retryJob-9.js.map +1 -1
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/commands/includes/addJobWithPriority.lua +2 -2
- package/dist/esm/commands/includes/getPriorityScore.lua +7 -0
- package/dist/esm/commands/includes/promoteDelayedJobs.lua +8 -3
- package/dist/esm/scripts/addDelayedJob-7.js +8 -2
- package/dist/esm/scripts/addDelayedJob-7.js.map +1 -1
- package/dist/esm/scripts/addParentJob-4.js +8 -2
- package/dist/esm/scripts/addParentJob-4.js.map +1 -1
- package/dist/esm/scripts/addPrioritizedJob-8.js +8 -2
- package/dist/esm/scripts/addPrioritizedJob-8.js.map +1 -1
- package/dist/esm/scripts/addStandardJob-6.js +8 -2
- package/dist/esm/scripts/addStandardJob-6.js.map +1 -1
- package/dist/esm/scripts/changePriority-5.js +8 -2
- package/dist/esm/scripts/changePriority-5.js.map +1 -1
- package/dist/esm/scripts/moveToActive-10.js +10 -12
- package/dist/esm/scripts/moveToActive-10.js.map +1 -1
- package/dist/esm/scripts/moveToDelayed-8.js +10 -12
- package/dist/esm/scripts/moveToDelayed-8.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-13.js +13 -4
- package/dist/esm/scripts/moveToFinished-13.js.map +1 -1
- package/dist/esm/scripts/promote-7.js +8 -2
- package/dist/esm/scripts/promote-7.js.map +1 -1
- package/dist/esm/scripts/retryJob-9.js +13 -4
- package/dist/esm/scripts/retryJob-9.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 +3 -2
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
-- Includes
|
|
6
6
|
--- @include "addPriorityMarkerIfNeeded"
|
|
7
|
+
--- @include "getPriorityScore"
|
|
7
8
|
|
|
8
9
|
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
9
|
-
local
|
|
10
|
-
local score = priority * 0x100000000 + bit.band(prioCounter, 0xffffffffffff)
|
|
10
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
11
11
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
12
12
|
if not paused then
|
|
13
13
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
]]
|
|
8
8
|
|
|
9
9
|
-- Includes
|
|
10
|
-
--- @include "
|
|
10
|
+
--- @include "addPriorityMarkerIfNeeded"
|
|
11
|
+
--- @include "getPriorityScore"
|
|
11
12
|
|
|
12
13
|
-- Try to get as much as 1000 jobs at once
|
|
13
14
|
local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey,
|
|
@@ -26,8 +27,8 @@ local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey
|
|
|
26
27
|
-- LIFO or FIFO
|
|
27
28
|
rcall("LPUSH", targetKey, jobId)
|
|
28
29
|
else
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
31
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
31
32
|
end
|
|
32
33
|
|
|
33
34
|
-- Emit waiting event
|
|
@@ -35,5 +36,9 @@ local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey
|
|
|
35
36
|
jobId, "prev", "delayed")
|
|
36
37
|
rcall("HSET", jobKey, "delay", 0)
|
|
37
38
|
end
|
|
39
|
+
|
|
40
|
+
if not paused then
|
|
41
|
+
addPriorityMarkerIfNeeded(targetKey)
|
|
42
|
+
end
|
|
38
43
|
end
|
|
39
44
|
end
|
|
@@ -146,9 +146,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
146
146
|
rcall("LPUSH", waitKey, "0:0")
|
|
147
147
|
end
|
|
148
148
|
end
|
|
149
|
-
|
|
149
|
+
--[[
|
|
150
|
+
Function to get priority score.
|
|
151
|
+
]]
|
|
152
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
150
153
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
151
|
-
|
|
154
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
155
|
+
end
|
|
156
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
157
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
152
158
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
153
159
|
if not paused then
|
|
154
160
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addDelayedJob-7.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-7.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"addDelayedJob-7.js","sourceRoot":"","sources":["../../../src/scripts/addDelayedJob-7.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Qf,CAAC;AACW,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
|
@@ -127,9 +127,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
127
127
|
rcall("LPUSH", waitKey, "0:0")
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
|
-
|
|
130
|
+
--[[
|
|
131
|
+
Function to get priority score.
|
|
132
|
+
]]
|
|
133
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
131
134
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
132
|
-
|
|
135
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
136
|
+
end
|
|
137
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
138
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
133
139
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
134
140
|
if not paused then
|
|
135
141
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"addParentJob-4.js","sourceRoot":"","sources":["../../../src/scripts/addParentJob-4.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Pf,CAAC;AACW,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
|
@@ -90,9 +90,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
90
90
|
rcall("LPUSH", waitKey, "0:0")
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
|
-
|
|
93
|
+
--[[
|
|
94
|
+
Function to get priority score.
|
|
95
|
+
]]
|
|
96
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
94
97
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
95
|
-
|
|
98
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
99
|
+
end
|
|
100
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
101
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
96
102
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
97
103
|
if not paused then
|
|
98
104
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"addPrioritizedJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addPrioritizedJob-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Qf,CAAC;AACW,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,mBAAmB;IACzB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
|
@@ -135,9 +135,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
135
135
|
rcall("LPUSH", waitKey, "0:0")
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
|
-
|
|
138
|
+
--[[
|
|
139
|
+
Function to get priority score.
|
|
140
|
+
]]
|
|
141
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
139
142
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
140
|
-
|
|
143
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
144
|
+
end
|
|
145
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
146
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
141
147
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
142
148
|
if not paused then
|
|
143
149
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addStandardJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-6.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"addStandardJob-6.js","sourceRoot":"","sources":["../../../src/scripts/addStandardJob-6.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Qf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
|
@@ -37,9 +37,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
37
37
|
rcall("LPUSH", waitKey, "0:0")
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
|
|
40
|
+
--[[
|
|
41
|
+
Function to get priority score.
|
|
42
|
+
]]
|
|
43
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
41
44
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
42
|
-
|
|
45
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
46
|
+
end
|
|
47
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
48
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
43
49
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
44
50
|
if not paused then
|
|
45
51
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changePriority-5.js","sourceRoot":"","sources":["../../../src/scripts/changePriority-5.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"changePriority-5.js","sourceRoot":"","sources":["../../../src/scripts/changePriority-5.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmFf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
|
@@ -155,10 +155,6 @@ end
|
|
|
155
155
|
'waiting'
|
|
156
156
|
]]
|
|
157
157
|
-- Includes
|
|
158
|
-
--[[
|
|
159
|
-
Function to add job considering priority.
|
|
160
|
-
]]
|
|
161
|
-
-- Includes
|
|
162
158
|
--[[
|
|
163
159
|
Function priority marker to wait if needed
|
|
164
160
|
in order to wake up our workers and to respect priority
|
|
@@ -170,13 +166,12 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
170
166
|
rcall("LPUSH", waitKey, "0:0")
|
|
171
167
|
end
|
|
172
168
|
end
|
|
173
|
-
|
|
169
|
+
--[[
|
|
170
|
+
Function to get priority score.
|
|
171
|
+
]]
|
|
172
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
174
173
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
175
|
-
|
|
176
|
-
rcall("ZADD", prioritizedKey, score, jobId)
|
|
177
|
-
if not paused then
|
|
178
|
-
addPriorityMarkerIfNeeded(waitKey)
|
|
179
|
-
end
|
|
174
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
180
175
|
end
|
|
181
176
|
-- Try to get as much as 1000 jobs at once
|
|
182
177
|
local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey,
|
|
@@ -192,14 +187,17 @@ local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey
|
|
|
192
187
|
-- LIFO or FIFO
|
|
193
188
|
rcall("LPUSH", targetKey, jobId)
|
|
194
189
|
else
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
191
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
197
192
|
end
|
|
198
193
|
-- Emit waiting event
|
|
199
194
|
rcall("XADD", eventStreamKey, "*", "event", "waiting", "jobId",
|
|
200
195
|
jobId, "prev", "delayed")
|
|
201
196
|
rcall("HSET", jobKey, "delay", 0)
|
|
202
197
|
end
|
|
198
|
+
if not paused then
|
|
199
|
+
addPriorityMarkerIfNeeded(targetKey)
|
|
200
|
+
end
|
|
203
201
|
end
|
|
204
202
|
end
|
|
205
203
|
local target, paused = getTargetQueueList(KEYS[9], waitKey, KEYS[8])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveToActive-10.js","sourceRoot":"","sources":["../../../src/scripts/moveToActive-10.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"moveToActive-10.js","sourceRoot":"","sources":["../../../src/scripts/moveToActive-10.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiPf,CAAC;AACW,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,cAAc;IACpB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|
|
@@ -82,10 +82,6 @@ end
|
|
|
82
82
|
'waiting'
|
|
83
83
|
]]
|
|
84
84
|
-- Includes
|
|
85
|
-
--[[
|
|
86
|
-
Function to add job considering priority.
|
|
87
|
-
]]
|
|
88
|
-
-- Includes
|
|
89
85
|
--[[
|
|
90
86
|
Function priority marker to wait if needed
|
|
91
87
|
in order to wake up our workers and to respect priority
|
|
@@ -97,13 +93,12 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
97
93
|
rcall("LPUSH", waitKey, "0:0")
|
|
98
94
|
end
|
|
99
95
|
end
|
|
100
|
-
|
|
96
|
+
--[[
|
|
97
|
+
Function to get priority score.
|
|
98
|
+
]]
|
|
99
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
101
100
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
102
|
-
|
|
103
|
-
rcall("ZADD", prioritizedKey, score, jobId)
|
|
104
|
-
if not paused then
|
|
105
|
-
addPriorityMarkerIfNeeded(waitKey)
|
|
106
|
-
end
|
|
101
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
107
102
|
end
|
|
108
103
|
-- Try to get as much as 1000 jobs at once
|
|
109
104
|
local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey,
|
|
@@ -119,14 +114,17 @@ local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey
|
|
|
119
114
|
-- LIFO or FIFO
|
|
120
115
|
rcall("LPUSH", targetKey, jobId)
|
|
121
116
|
else
|
|
122
|
-
|
|
123
|
-
|
|
117
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
118
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
124
119
|
end
|
|
125
120
|
-- Emit waiting event
|
|
126
121
|
rcall("XADD", eventStreamKey, "*", "event", "waiting", "jobId",
|
|
127
122
|
jobId, "prev", "delayed")
|
|
128
123
|
rcall("HSET", jobKey, "delay", 0)
|
|
129
124
|
end
|
|
125
|
+
if not paused then
|
|
126
|
+
addPriorityMarkerIfNeeded(targetKey)
|
|
127
|
+
end
|
|
130
128
|
end
|
|
131
129
|
end
|
|
132
130
|
local jobKey = KEYS[5]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveToDelayed-8.js","sourceRoot":"","sources":["../../../src/scripts/moveToDelayed-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"moveToDelayed-8.js","sourceRoot":"","sources":["../../../src/scripts/moveToDelayed-8.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Jf,CAAC;AACW,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
|
@@ -240,9 +240,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
240
240
|
rcall("LPUSH", waitKey, "0:0")
|
|
241
241
|
end
|
|
242
242
|
end
|
|
243
|
-
|
|
243
|
+
--[[
|
|
244
|
+
Function to get priority score.
|
|
245
|
+
]]
|
|
246
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
244
247
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
245
|
-
|
|
248
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
249
|
+
end
|
|
250
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
251
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
246
252
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
247
253
|
if not paused then
|
|
248
254
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -339,14 +345,17 @@ local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey
|
|
|
339
345
|
-- LIFO or FIFO
|
|
340
346
|
rcall("LPUSH", targetKey, jobId)
|
|
341
347
|
else
|
|
342
|
-
|
|
343
|
-
|
|
348
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
349
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
344
350
|
end
|
|
345
351
|
-- Emit waiting event
|
|
346
352
|
rcall("XADD", eventStreamKey, "*", "event", "waiting", "jobId",
|
|
347
353
|
jobId, "prev", "delayed")
|
|
348
354
|
rcall("HSET", jobKey, "delay", 0)
|
|
349
355
|
end
|
|
356
|
+
if not paused then
|
|
357
|
+
addPriorityMarkerIfNeeded(targetKey)
|
|
358
|
+
end
|
|
350
359
|
end
|
|
351
360
|
end
|
|
352
361
|
--[[
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moveToFinished-13.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-13.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"moveToFinished-13.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-13.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAypBf,CAAC;AACW,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|
|
@@ -37,9 +37,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
37
37
|
rcall("LPUSH", waitKey, "0:0")
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
|
|
40
|
+
--[[
|
|
41
|
+
Function to get priority score.
|
|
42
|
+
]]
|
|
43
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
41
44
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
42
|
-
|
|
45
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
46
|
+
end
|
|
47
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
48
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
43
49
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
44
50
|
if not paused then
|
|
45
51
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote-7.js","sourceRoot":"","sources":["../../../src/scripts/promote-7.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"promote-7.js","sourceRoot":"","sources":["../../../src/scripts/promote-7.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAmFZ,CAAC;AACQ,QAAA,OAAO,GAAG;IACrB,IAAI,EAAE,SAAS;IACf,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
|
@@ -42,9 +42,15 @@ local function addPriorityMarkerIfNeeded(waitKey)
|
|
|
42
42
|
rcall("LPUSH", waitKey, "0:0")
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
|
-
|
|
45
|
+
--[[
|
|
46
|
+
Function to get priority score.
|
|
47
|
+
]]
|
|
48
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
46
49
|
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
47
|
-
|
|
50
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
51
|
+
end
|
|
52
|
+
local function addJobWithPriority(waitKey, prioritizedKey, priority, paused, jobId, priorityCounterKey)
|
|
53
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
48
54
|
rcall("ZADD", prioritizedKey, score, jobId)
|
|
49
55
|
if not paused then
|
|
50
56
|
addPriorityMarkerIfNeeded(waitKey)
|
|
@@ -82,14 +88,17 @@ local function promoteDelayedJobs(delayedKey, waitKey, targetKey, prioritizedKey
|
|
|
82
88
|
-- LIFO or FIFO
|
|
83
89
|
rcall("LPUSH", targetKey, jobId)
|
|
84
90
|
else
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
92
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
87
93
|
end
|
|
88
94
|
-- Emit waiting event
|
|
89
95
|
rcall("XADD", eventStreamKey, "*", "event", "waiting", "jobId",
|
|
90
96
|
jobId, "prev", "delayed")
|
|
91
97
|
rcall("HSET", jobKey, "delay", 0)
|
|
92
98
|
end
|
|
99
|
+
if not paused then
|
|
100
|
+
addPriorityMarkerIfNeeded(targetKey)
|
|
101
|
+
end
|
|
93
102
|
end
|
|
94
103
|
end
|
|
95
104
|
local target, paused = getTargetQueueList(KEYS[5], KEYS[2], KEYS[3])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retryJob-9.js","sourceRoot":"","sources":["../../../src/scripts/retryJob-9.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG
|
|
1
|
+
{"version":3,"file":"retryJob-9.js","sourceRoot":"","sources":["../../../src/scripts/retryJob-9.ts"],"names":[],"mappings":";;;AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiIf,CAAC;AACW,QAAA,QAAQ,GAAG;IACtB,IAAI,EAAE,UAAU;IAChB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|