bullmq 6.3.14 → 6.3.16
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/redis-queue-backend.js +2 -0
- package/dist/cjs/classes/valkey-glide-client.js +9 -1
- package/dist/cjs/commands/{reprocessJob-7.lua → reprocessJob-9.lua} +11 -1
- package/dist/cjs/scripts/index.js +1 -1
- package/dist/cjs/scripts/{reprocessJob-7.js → reprocessJob-9.js} +27 -2
- package/dist/cjs/tsconfig-cjs.tsbuildinfo +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/classes/redis-queue-backend.js +2 -0
- package/dist/esm/classes/valkey-glide-client.js +9 -1
- package/dist/esm/commands/{reprocessJob-7.lua → reprocessJob-9.lua} +11 -1
- package/dist/esm/scripts/index.d.ts +1 -1
- package/dist/esm/scripts/index.js +1 -1
- package/dist/esm/scripts/{reprocessJob-7.js → reprocessJob-9.js} +27 -2
- 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/{reprocessJob-7.d.ts → reprocessJob-9.d.ts} +0 -0
|
@@ -698,7 +698,15 @@ class ValkeyGlideAdapter extends events_1.EventEmitter {
|
|
|
698
698
|
return null;
|
|
699
699
|
}
|
|
700
700
|
async info() {
|
|
701
|
-
|
|
701
|
+
// Resolve the raw client inside the serialized callback so cluster
|
|
702
|
+
// detection sees duplicated clients' raw client while closure errors are
|
|
703
|
+
// still normalized. In cluster mode INFO must be routed to a single node.
|
|
704
|
+
return toStringValue(await this.runSerialized(raw => {
|
|
705
|
+
var _a, _b;
|
|
706
|
+
return raw.customCommand(['INFO'], ((_b = (_a = raw.constructor) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.includes('Cluster'))
|
|
707
|
+
? { route: 'randomNode' }
|
|
708
|
+
: undefined);
|
|
709
|
+
}));
|
|
702
710
|
}
|
|
703
711
|
async clientSetName(name) {
|
|
704
712
|
return this.runRawCommand(['CLIENT', 'SETNAME', name], {
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
KEYS[5] meta
|
|
10
10
|
KEYS[6] active key
|
|
11
11
|
KEYS[7] marker key
|
|
12
|
+
KEYS[8] prioritized key
|
|
13
|
+
KEYS[9] priority counter key
|
|
12
14
|
|
|
13
15
|
ARGV[1] job.id
|
|
14
16
|
ARGV[2] (job.opts.lifo ? 'R' : 'L') + 'PUSH'
|
|
@@ -26,6 +28,7 @@ local rcall = redis.call;
|
|
|
26
28
|
|
|
27
29
|
-- Includes
|
|
28
30
|
--- @include "includes/addJobInTargetList"
|
|
31
|
+
--- @include "includes/addJobWithPriority"
|
|
29
32
|
--- @include "includes/getOrSetMaxEvents"
|
|
30
33
|
--- @include "includes/isQueuePausedOrMaxed"
|
|
31
34
|
--- @include "includes/moveChildBackToParentDependencies"
|
|
@@ -47,7 +50,14 @@ if rcall("EXISTS", jobKey) == 1 then
|
|
|
47
50
|
rcall("HDEL", jobKey, "finishedOn", "processedOn", ARGV[3], unpack(attributesToRemove))
|
|
48
51
|
|
|
49
52
|
local isPausedOrMaxed = isQueuePausedOrMaxed(KEYS[5], KEYS[6])
|
|
50
|
-
|
|
53
|
+
local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
|
|
54
|
+
|
|
55
|
+
-- Standard or priority add
|
|
56
|
+
if priority == 0 then
|
|
57
|
+
addJobInTargetList(KEYS[4], KEYS[7], ARGV[2], isPausedOrMaxed, jobId)
|
|
58
|
+
else
|
|
59
|
+
addJobWithPriority(KEYS[7], KEYS[8], priority, jobId, KEYS[9], isPausedOrMaxed)
|
|
60
|
+
end
|
|
51
61
|
|
|
52
62
|
moveChildBackToParentDependencies(jobKey, ARGV[4])
|
|
53
63
|
|
|
@@ -44,7 +44,7 @@ tslib_1.__exportStar(require("./removeJob-2"), exports);
|
|
|
44
44
|
tslib_1.__exportStar(require("./removeJobScheduler-3"), exports);
|
|
45
45
|
tslib_1.__exportStar(require("./removeOrphanedJobs-1"), exports);
|
|
46
46
|
tslib_1.__exportStar(require("./removeUnprocessedChildren-2"), exports);
|
|
47
|
-
tslib_1.__exportStar(require("./reprocessJob-
|
|
47
|
+
tslib_1.__exportStar(require("./reprocessJob-9"), exports);
|
|
48
48
|
tslib_1.__exportStar(require("./retryJob-11"), exports);
|
|
49
49
|
tslib_1.__exportStar(require("./saveStacktrace-1"), exports);
|
|
50
50
|
tslib_1.__exportStar(require("./updateData-1"), exports);
|
|
@@ -11,6 +11,8 @@ const content = `--[[
|
|
|
11
11
|
KEYS[5] meta
|
|
12
12
|
KEYS[6] active key
|
|
13
13
|
KEYS[7] marker key
|
|
14
|
+
KEYS[8] prioritized key
|
|
15
|
+
KEYS[9] priority counter key
|
|
14
16
|
ARGV[1] job.id
|
|
15
17
|
ARGV[2] (job.opts.lifo ? 'R' : 'L') + 'PUSH'
|
|
16
18
|
ARGV[3] propVal - failedReason/returnvalue
|
|
@@ -40,6 +42,23 @@ local function addJobInTargetList(targetKey, markerKey, pushCmd, isPausedOrMaxed
|
|
|
40
42
|
rcall(pushCmd, targetKey, jobId)
|
|
41
43
|
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
|
42
44
|
end
|
|
45
|
+
--[[
|
|
46
|
+
Function to add job considering priority.
|
|
47
|
+
]]
|
|
48
|
+
-- Includes
|
|
49
|
+
--[[
|
|
50
|
+
Function to get priority score.
|
|
51
|
+
]]
|
|
52
|
+
local function getPriorityScore(priority, priorityCounterKey)
|
|
53
|
+
local prioCounter = rcall("INCR", priorityCounterKey)
|
|
54
|
+
return priority * 0x100000000 + prioCounter % 0x100000000
|
|
55
|
+
end
|
|
56
|
+
local function addJobWithPriority(markerKey, prioritizedKey, priority, jobId, priorityCounterKey,
|
|
57
|
+
isPausedOrMaxed)
|
|
58
|
+
local score = getPriorityScore(priority, priorityCounterKey)
|
|
59
|
+
rcall("ZADD", prioritizedKey, score, jobId)
|
|
60
|
+
addBaseMarkerIfNeeded(markerKey, isPausedOrMaxed)
|
|
61
|
+
end
|
|
43
62
|
--[[
|
|
44
63
|
Function to get max events value or set by default 10000.
|
|
45
64
|
]]
|
|
@@ -99,7 +118,13 @@ if rcall("EXISTS", jobKey) == 1 then
|
|
|
99
118
|
end
|
|
100
119
|
rcall("HDEL", jobKey, "finishedOn", "processedOn", ARGV[3], unpack(attributesToRemove))
|
|
101
120
|
local isPausedOrMaxed = isQueuePausedOrMaxed(KEYS[5], KEYS[6])
|
|
102
|
-
|
|
121
|
+
local priority = tonumber(rcall("HGET", jobKey, "priority")) or 0
|
|
122
|
+
-- Standard or priority add
|
|
123
|
+
if priority == 0 then
|
|
124
|
+
addJobInTargetList(KEYS[4], KEYS[7], ARGV[2], isPausedOrMaxed, jobId)
|
|
125
|
+
else
|
|
126
|
+
addJobWithPriority(KEYS[7], KEYS[8], priority, jobId, KEYS[9], isPausedOrMaxed)
|
|
127
|
+
end
|
|
103
128
|
moveChildBackToParentDependencies(jobKey, ARGV[4])
|
|
104
129
|
local maxEvents = getOrSetMaxEvents(KEYS[5])
|
|
105
130
|
-- Emit waiting event
|
|
@@ -116,5 +141,5 @@ end
|
|
|
116
141
|
exports.reprocessJob = {
|
|
117
142
|
name: 'reprocessJob',
|
|
118
143
|
content,
|
|
119
|
-
keys:
|
|
144
|
+
keys: 9,
|
|
120
145
|
};
|