bullmq 3.5.4 → 3.5.6
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/backoffs.d.ts +2 -3
- package/dist/cjs/classes/backoffs.js.map +1 -1
- package/dist/cjs/classes/job.d.ts +6 -24
- package/dist/cjs/classes/job.js.map +1 -1
- package/dist/cjs/classes/queue-base.d.ts +2 -1
- package/dist/cjs/classes/queue-base.js.map +1 -1
- package/dist/cjs/classes/queue.d.ts +2 -2
- package/dist/cjs/classes/queue.js.map +1 -1
- package/dist/cjs/classes/scripts.d.ts +9 -17
- package/dist/cjs/classes/scripts.js.map +1 -1
- package/dist/cjs/classes/worker.js +11 -4
- package/dist/cjs/classes/worker.js.map +1 -1
- package/dist/cjs/commands/addJob-8.lua +2 -7
- package/dist/cjs/commands/includes/addDelayMarkerIfNeeded.lua +15 -0
- package/dist/cjs/commands/includes/updateParentDepsIfNeeded.lua +2 -6
- package/dist/cjs/commands/moveToActive-9.lua +1 -1
- package/dist/cjs/commands/moveToDelayed-8.lua +6 -9
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/interfaces/index.js.map +1 -1
- package/dist/cjs/interfaces/minimal-job.d.ts +129 -0
- package/dist/cjs/interfaces/minimal-job.js +3 -0
- package/dist/cjs/interfaces/minimal-job.js.map +1 -0
- package/dist/cjs/interfaces/parent.d.ts +5 -0
- package/dist/cjs/scripts/addJob-8.js +27 -26
- package/dist/cjs/scripts/addJob-8.js.map +1 -1
- package/dist/cjs/scripts/moveToActive-9.js +1 -1
- package/dist/cjs/scripts/moveToDelayed-8.js +39 -32
- package/dist/cjs/scripts/moveToDelayed-8.js.map +1 -1
- package/dist/cjs/scripts/moveToFinished-12.js +13 -6
- package/dist/cjs/scripts/moveToFinished-12.js.map +1 -1
- package/dist/cjs/types/backoff-strategy.d.ts +2 -2
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/index.js +1 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/minimal-queue.d.ts +2 -0
- package/dist/cjs/types/minimal-queue.js +3 -0
- package/dist/cjs/types/minimal-queue.js.map +1 -0
- package/dist/esm/classes/backoffs.d.ts +2 -3
- package/dist/esm/classes/backoffs.js.map +1 -1
- package/dist/esm/classes/job.d.ts +6 -24
- package/dist/esm/classes/job.js.map +1 -1
- package/dist/esm/classes/queue-base.d.ts +2 -1
- package/dist/esm/classes/queue-base.js.map +1 -1
- package/dist/esm/classes/queue.d.ts +2 -2
- package/dist/esm/classes/queue.js.map +1 -1
- package/dist/esm/classes/scripts.d.ts +9 -17
- package/dist/esm/classes/scripts.js.map +1 -1
- package/dist/esm/classes/worker.js +11 -4
- package/dist/esm/classes/worker.js.map +1 -1
- package/dist/esm/commands/addJob-8.lua +2 -7
- package/dist/esm/commands/includes/addDelayMarkerIfNeeded.lua +15 -0
- package/dist/esm/commands/includes/updateParentDepsIfNeeded.lua +2 -6
- package/dist/esm/commands/moveToActive-9.lua +1 -1
- package/dist/esm/commands/moveToDelayed-8.lua +6 -9
- package/dist/esm/interfaces/index.d.ts +1 -0
- package/dist/esm/interfaces/index.js +1 -0
- package/dist/esm/interfaces/index.js.map +1 -1
- package/dist/esm/interfaces/minimal-job.d.ts +129 -0
- package/dist/esm/interfaces/minimal-job.js +2 -0
- package/dist/esm/interfaces/minimal-job.js.map +1 -0
- package/dist/esm/interfaces/parent.d.ts +5 -0
- package/dist/esm/scripts/addJob-8.js +27 -26
- package/dist/esm/scripts/addJob-8.js.map +1 -1
- package/dist/esm/scripts/moveToActive-9.js +1 -1
- package/dist/esm/scripts/moveToDelayed-8.js +39 -32
- package/dist/esm/scripts/moveToDelayed-8.js.map +1 -1
- package/dist/esm/scripts/moveToFinished-12.js +13 -6
- package/dist/esm/scripts/moveToFinished-12.js.map +1 -1
- package/dist/esm/types/backoff-strategy.d.ts +2 -2
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/minimal-queue.d.ts +2 -0
- package/dist/esm/types/minimal-queue.js +2 -0
- package/dist/esm/types/minimal-queue.js.map +1 -0
- package/package.json +3 -1
@@ -0,0 +1,129 @@
|
|
1
|
+
import { JobsOptions, JobJsonSandbox } from '../types';
|
2
|
+
import { JobJson } from './job-json';
|
3
|
+
import { ParentKeys } from './parent';
|
4
|
+
export type BulkJobOptions = Omit<JobsOptions, 'repeat'>;
|
5
|
+
export interface MoveToWaitingChildrenOpts {
|
6
|
+
child?: {
|
7
|
+
id: string;
|
8
|
+
queue: string;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
export interface DependenciesOpts {
|
12
|
+
processed?: {
|
13
|
+
cursor?: number;
|
14
|
+
count?: number;
|
15
|
+
};
|
16
|
+
unprocessed?: {
|
17
|
+
cursor?: number;
|
18
|
+
count?: number;
|
19
|
+
};
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* MinimalJob
|
23
|
+
*/
|
24
|
+
export interface MinimalJob<DataType = any, ReturnType = any, NameType extends string = string> {
|
25
|
+
/**
|
26
|
+
* The name of the Job
|
27
|
+
*/
|
28
|
+
name: NameType;
|
29
|
+
/**
|
30
|
+
* The payload for this job.
|
31
|
+
*/
|
32
|
+
data: DataType;
|
33
|
+
/**
|
34
|
+
* The options object for this job.
|
35
|
+
*/
|
36
|
+
opts: JobsOptions;
|
37
|
+
id?: string;
|
38
|
+
/**
|
39
|
+
* The progress a job has performed so far.
|
40
|
+
* @defaultValue 0
|
41
|
+
*/
|
42
|
+
progress: number | object;
|
43
|
+
/**
|
44
|
+
* The value returned by the processor when processing this job.
|
45
|
+
* @defaultValue null
|
46
|
+
*/
|
47
|
+
returnvalue: ReturnType;
|
48
|
+
/**
|
49
|
+
* Stacktrace for the error (for failed jobs).
|
50
|
+
* @defaultValue null
|
51
|
+
*/
|
52
|
+
stacktrace: string[];
|
53
|
+
/**
|
54
|
+
* An amount of milliseconds to wait until this job can be processed.
|
55
|
+
* @defaultValue 0
|
56
|
+
*/
|
57
|
+
delay: number;
|
58
|
+
/**
|
59
|
+
* Timestamp when the job was created (unless overridden with job options).
|
60
|
+
*/
|
61
|
+
timestamp: number;
|
62
|
+
/**
|
63
|
+
* Number of attempts after the job has failed.
|
64
|
+
* @defaultValue 0
|
65
|
+
*/
|
66
|
+
attemptsMade: number;
|
67
|
+
/**
|
68
|
+
* Reason for failing.
|
69
|
+
*/
|
70
|
+
failedReason: string;
|
71
|
+
/**
|
72
|
+
* Timestamp for when the job finished (completed or failed).
|
73
|
+
*/
|
74
|
+
finishedOn?: number;
|
75
|
+
/**
|
76
|
+
* Timestamp for when the job was processed.
|
77
|
+
*/
|
78
|
+
processedOn?: number;
|
79
|
+
/**
|
80
|
+
* Fully qualified key (including the queue prefix) pointing to the parent of this job.
|
81
|
+
*/
|
82
|
+
parentKey?: string;
|
83
|
+
/**
|
84
|
+
* Object that contains parentId (id) and parent queueKey.
|
85
|
+
*/
|
86
|
+
parent?: ParentKeys;
|
87
|
+
/**
|
88
|
+
* Base repeat job key.
|
89
|
+
*/
|
90
|
+
repeatJobKey?: string;
|
91
|
+
/**
|
92
|
+
* Prepares a job to be serialized for storage in Redis.
|
93
|
+
* @returns
|
94
|
+
*/
|
95
|
+
asJSON(): JobJson;
|
96
|
+
/**
|
97
|
+
* Prepares a job to be passed to Sandbox.
|
98
|
+
* @returns
|
99
|
+
*/
|
100
|
+
asJSONSandbox(): JobJsonSandbox;
|
101
|
+
/**
|
102
|
+
* Updates a job's data
|
103
|
+
*
|
104
|
+
* @param data - the data that will replace the current jobs data.
|
105
|
+
*/
|
106
|
+
update(data: DataType): Promise<void>;
|
107
|
+
/**
|
108
|
+
* Updates a job's progress
|
109
|
+
*
|
110
|
+
* @param progress - number or object to be saved as progress.
|
111
|
+
*/
|
112
|
+
updateProgress(progress: number | object): Promise<void>;
|
113
|
+
/**
|
114
|
+
* Logs one row of log data.
|
115
|
+
*
|
116
|
+
* @param logRow - string with log data to be logged.
|
117
|
+
*/
|
118
|
+
log(logRow: string): Promise<number>;
|
119
|
+
get queueName(): string;
|
120
|
+
/**
|
121
|
+
* @returns the prefix that is used.
|
122
|
+
*/
|
123
|
+
get prefix(): string;
|
124
|
+
/**
|
125
|
+
* @returns it includes the prefix, the namespace separator :, and queue name.
|
126
|
+
* @see https://www.gnu.org/software/gawk/manual/html_node/Qualified-Names.html
|
127
|
+
*/
|
128
|
+
get queueQualifiedName(): string;
|
129
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"minimal-job.js","sourceRoot":"","sources":["../../../src/interfaces/minimal-job.ts"],"names":[],"mappings":""}
|
@@ -48,6 +48,31 @@ local repeatJobKey = args[9]
|
|
48
48
|
local parent = args[8]
|
49
49
|
local parentData
|
50
50
|
-- Includes
|
51
|
+
--[[
|
52
|
+
Add delay marker if needed.
|
53
|
+
]]
|
54
|
+
-- Includes
|
55
|
+
--[[
|
56
|
+
Function to return the next delayed job timestamp.
|
57
|
+
]]
|
58
|
+
local function getNextDelayedTimestamp(delayedKey)
|
59
|
+
local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
|
60
|
+
if #result then
|
61
|
+
local nextTimestamp = tonumber(result[2])
|
62
|
+
if (nextTimestamp ~= nil) then
|
63
|
+
nextTimestamp = nextTimestamp / 0x1000
|
64
|
+
end
|
65
|
+
return nextTimestamp
|
66
|
+
end
|
67
|
+
end
|
68
|
+
local function addDelayMarkerIfNeeded(target, delayedKey)
|
69
|
+
if rcall("LLEN", target) == 0 then
|
70
|
+
local nextTimestamp = getNextDelayedTimestamp(delayedKey)
|
71
|
+
if nextTimestamp ~= nil then
|
72
|
+
rcall("LPUSH", target, "0:" .. nextTimestamp)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
51
76
|
--[[
|
52
77
|
Function to add job considering priority.
|
53
78
|
]]
|
@@ -84,19 +109,6 @@ local function trimEvents(metaKey, eventStreamKey)
|
|
84
109
|
rcall("XTRIM", eventStreamKey, "MAXLEN", "~", 10000)
|
85
110
|
end
|
86
111
|
end
|
87
|
-
--[[
|
88
|
-
Function to return the next delayed job timestamp.
|
89
|
-
]]
|
90
|
-
local function getNextDelayedTimestamp(delayedKey)
|
91
|
-
local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
|
92
|
-
if #result then
|
93
|
-
local nextTimestamp = tonumber(result[2])
|
94
|
-
if (nextTimestamp ~= nil) then
|
95
|
-
nextTimestamp = nextTimestamp / 0x1000
|
96
|
-
end
|
97
|
-
return nextTimestamp
|
98
|
-
end
|
99
|
-
end
|
100
112
|
--[[
|
101
113
|
Validate and move or add dependencies to parent.
|
102
114
|
]]
|
@@ -118,12 +130,7 @@ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDepende
|
|
118
130
|
local score = delayedTimestamp * 0x1000
|
119
131
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
120
132
|
rcall("ZADD", parentDelayedKey, score, parentId)
|
121
|
-
|
122
|
-
local nextTimestamp = getNextDelayedTimestamp(parentDelayedKey)
|
123
|
-
if not nextTimestamp or (delayedTimestamp <= nextTimestamp) then
|
124
|
-
rcall("LPUSH", parentTarget, "0:" .. delayedTimestamp - tonumber(timestamp))
|
125
|
-
end
|
126
|
-
end
|
133
|
+
addDelayMarkerIfNeeded(parentTarget, parentDelayedKey)
|
127
134
|
-- Standard or priority add
|
128
135
|
elseif priority == 0 then
|
129
136
|
rcall("RPUSH", parentTarget, parentId)
|
@@ -200,13 +207,7 @@ elseif (delayedTimestamp ~= 0) then
|
|
200
207
|
-- If wait list is empty, and this delayed job is the next one to be processed,
|
201
208
|
-- then we need to signal the workers by adding a dummy job (jobId 0:delay) to the wait list.
|
202
209
|
local target = getTargetQueueList(KEYS[3], KEYS[1], KEYS[2])
|
203
|
-
|
204
|
-
local nextTimestamp = getNextDelayedTimestamp(KEYS[5])
|
205
|
-
if not nextTimestamp or (delayedTimestamp < nextTimestamp) then
|
206
|
-
local delay = delayedTimestamp - tonumber(timestamp)
|
207
|
-
rcall("LPUSH", target, "0:" .. delay)
|
208
|
-
end
|
209
|
-
end
|
210
|
+
addDelayMarkerIfNeeded(target, KEYS[5])
|
210
211
|
else
|
211
212
|
local target = getTargetQueueList(KEYS[3], KEYS[1], KEYS[2])
|
212
213
|
-- Standard or priority add
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addJob-8.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"addJob-8.js","sourceRoot":"","sources":["../../../src/scripts/addJob-8.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuOf,CAAC;AACF,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,QAAQ;IACd,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -196,7 +196,7 @@ end
|
|
196
196
|
-- Return the timestamp for the next delayed job if any.
|
197
197
|
local nextTimestamp = getNextDelayedTimestamp(KEYS[7])
|
198
198
|
if (nextTimestamp ~= nil) then
|
199
|
-
|
199
|
+
return { 0, 0, 0, nextTimestamp}
|
200
200
|
end
|
201
201
|
`;
|
202
202
|
export const moveToActive = {
|
@@ -23,6 +23,42 @@ const content = `--[[
|
|
23
23
|
]]
|
24
24
|
local rcall = redis.call
|
25
25
|
-- Includes
|
26
|
+
--[[
|
27
|
+
Add delay marker if needed.
|
28
|
+
]]
|
29
|
+
-- Includes
|
30
|
+
--[[
|
31
|
+
Function to return the next delayed job timestamp.
|
32
|
+
]]
|
33
|
+
local function getNextDelayedTimestamp(delayedKey)
|
34
|
+
local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
|
35
|
+
if #result then
|
36
|
+
local nextTimestamp = tonumber(result[2])
|
37
|
+
if (nextTimestamp ~= nil) then
|
38
|
+
nextTimestamp = nextTimestamp / 0x1000
|
39
|
+
end
|
40
|
+
return nextTimestamp
|
41
|
+
end
|
42
|
+
end
|
43
|
+
local function addDelayMarkerIfNeeded(target, delayedKey)
|
44
|
+
if rcall("LLEN", target) == 0 then
|
45
|
+
local nextTimestamp = getNextDelayedTimestamp(delayedKey)
|
46
|
+
if nextTimestamp ~= nil then
|
47
|
+
rcall("LPUSH", target, "0:" .. nextTimestamp)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
--[[
|
52
|
+
Function to check for the meta.paused key to decide if we are paused or not
|
53
|
+
(since an empty list and !EXISTS are not really the same).
|
54
|
+
]]
|
55
|
+
local function getTargetQueueList(queueMetaKey, waitKey, pausedKey)
|
56
|
+
if rcall("HEXISTS", queueMetaKey, "paused") ~= 1 then
|
57
|
+
return waitKey
|
58
|
+
else
|
59
|
+
return pausedKey
|
60
|
+
end
|
61
|
+
end
|
26
62
|
--[[
|
27
63
|
Updates the delay set, by moving delayed jobs that should
|
28
64
|
be processed now to "wait".
|
@@ -45,17 +81,6 @@ local function addJobWithPriority(priorityKey, priority, targetKey, jobId)
|
|
45
81
|
rcall("RPUSH", targetKey, jobId)
|
46
82
|
end
|
47
83
|
end
|
48
|
-
--[[
|
49
|
-
Function to check for the meta.paused key to decide if we are paused or not
|
50
|
-
(since an empty list and !EXISTS are not really the same).
|
51
|
-
]]
|
52
|
-
local function getTargetQueueList(queueMetaKey, waitKey, pausedKey)
|
53
|
-
if rcall("HEXISTS", queueMetaKey, "paused") ~= 1 then
|
54
|
-
return waitKey
|
55
|
-
else
|
56
|
-
return pausedKey
|
57
|
-
end
|
58
|
-
end
|
59
84
|
-- Try to get as much as 1000 jobs at once
|
60
85
|
local function promoteDelayedJobs(delayedKey, waitKey, priorityKey, pausedKey,
|
61
86
|
metaKey, eventStreamKey, prefix, timestamp)
|
@@ -80,19 +105,6 @@ local function promoteDelayedJobs(delayedKey, waitKey, priorityKey, pausedKey,
|
|
80
105
|
end
|
81
106
|
end
|
82
107
|
end
|
83
|
-
--[[
|
84
|
-
Function to return the next delayed job timestamp.
|
85
|
-
]]
|
86
|
-
local function getNextDelayedTimestamp(delayedKey)
|
87
|
-
local result = rcall("ZRANGE", delayedKey, 0, 0, "WITHSCORES")
|
88
|
-
if #result then
|
89
|
-
local nextTimestamp = tonumber(result[2])
|
90
|
-
if (nextTimestamp ~= nil) then
|
91
|
-
nextTimestamp = nextTimestamp / 0x1000
|
92
|
-
end
|
93
|
-
return nextTimestamp
|
94
|
-
end
|
95
|
-
end
|
96
108
|
local jobKey = KEYS[5]
|
97
109
|
if rcall("EXISTS", jobKey) == 1 then
|
98
110
|
local delayedKey = KEYS[4]
|
@@ -111,16 +123,11 @@ if rcall("EXISTS", jobKey) == 1 then
|
|
111
123
|
if (numRemovedElements < 1) then
|
112
124
|
return -3
|
113
125
|
end
|
114
|
-
-- Check if we need to push a marker job to wake up sleeping workers.
|
115
|
-
local target = getTargetQueueList(KEYS[8], KEYS[1], KEYS[7])
|
116
|
-
if rcall("LLEN", target) == 0 then
|
117
|
-
local nextTimestamp = getNextDelayedTimestamp(delayedKey)
|
118
|
-
if not nextTimestamp or (delayedTimestamp < nextTimestamp) then
|
119
|
-
rcall("LPUSH", target, "0:" .. delayedTimestamp - tonumber(ARGV[2]))
|
120
|
-
end
|
121
|
-
end
|
122
126
|
rcall("ZADD", delayedKey, score, jobId)
|
123
127
|
rcall("XADD", KEYS[6], "*", "event", "delayed", "jobId", jobId, "delay", delayedTimestamp)
|
128
|
+
-- Check if we need to push a marker job to wake up sleeping workers.
|
129
|
+
local target = getTargetQueueList(KEYS[8], KEYS[1], KEYS[7])
|
130
|
+
addDelayMarkerIfNeeded(target, delayedKey)
|
124
131
|
return 0
|
125
132
|
else
|
126
133
|
return -1
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsIf,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,eAAe;IACrB,OAAO;IACP,IAAI,EAAE,CAAC;CACR,CAAC"}
|
@@ -376,6 +376,18 @@ end
|
|
376
376
|
Validate and move or add dependencies to parent.
|
377
377
|
]]
|
378
378
|
-- Includes
|
379
|
+
--[[
|
380
|
+
Add delay marker if needed.
|
381
|
+
]]
|
382
|
+
-- Includes
|
383
|
+
local function addDelayMarkerIfNeeded(target, delayedKey)
|
384
|
+
if rcall("LLEN", target) == 0 then
|
385
|
+
local nextTimestamp = getNextDelayedTimestamp(delayedKey)
|
386
|
+
if nextTimestamp ~= nil then
|
387
|
+
rcall("LPUSH", target, "0:" .. nextTimestamp)
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
379
391
|
local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDependenciesKey,
|
380
392
|
parentId, jobIdKey, returnvalue, timestamp )
|
381
393
|
local processedSet = parentKey .. ":processed"
|
@@ -393,12 +405,7 @@ local function updateParentDepsIfNeeded(parentKey, parentQueueKey, parentDepende
|
|
393
405
|
local score = delayedTimestamp * 0x1000
|
394
406
|
local parentDelayedKey = parentQueueKey .. ":delayed"
|
395
407
|
rcall("ZADD", parentDelayedKey, score, parentId)
|
396
|
-
|
397
|
-
local nextTimestamp = getNextDelayedTimestamp(parentDelayedKey)
|
398
|
-
if not nextTimestamp or (delayedTimestamp <= nextTimestamp) then
|
399
|
-
rcall("LPUSH", parentTarget, "0:" .. delayedTimestamp - tonumber(timestamp))
|
400
|
-
end
|
401
|
-
end
|
408
|
+
addDelayMarkerIfNeeded(parentTarget, parentDelayedKey)
|
402
409
|
-- Standard or priority add
|
403
410
|
elseif priority == 0 then
|
404
411
|
rcall("RPUSH", parentTarget, parentId)
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"moveToFinished-12.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-12.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG
|
1
|
+
{"version":3,"file":"moveToFinished-12.js","sourceRoot":"","sources":["../../../src/scripts/moveToFinished-12.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqjBf,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,gBAAgB;IACtB,OAAO;IACP,IAAI,EAAE,EAAE;CACT,CAAC"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
export type BackoffStrategy = (attemptsMade?: number, type?: string, err?: Error, job?:
|
1
|
+
import { MinimalJob } from '../interfaces/minimal-job';
|
2
|
+
export type BackoffStrategy = (attemptsMade?: number, type?: string, err?: Error, job?: MinimalJob) => Promise<number> | number;
|
package/dist/esm/types/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"minimal-queue.js","sourceRoot":"","sources":["../../../src/types/minimal-queue.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bullmq",
|
3
|
-
"version": "3.5.
|
3
|
+
"version": "3.5.6",
|
4
4
|
"description": "Queue for messages and jobs based on Redis",
|
5
5
|
"main": "./dist/cjs/index.js",
|
6
6
|
"module": "./dist/esm/index.js",
|
@@ -44,6 +44,7 @@
|
|
44
44
|
"test": "ts-mocha -p tsconfig-cjs.json --config ./.mocharc.js",
|
45
45
|
"test:watch": "ts-mocha -p tsconfig-cjs.json --paths 'tests/test_*.ts' -w --watch-extensions ts",
|
46
46
|
"tsc": "tsc",
|
47
|
+
"circular:references": "madge --circular --extensions ts ./src",
|
47
48
|
"tsc:all": "tsc && tsc -p tsconfig-cjs.json"
|
48
49
|
},
|
49
50
|
"dependencies": {
|
@@ -93,6 +94,7 @@
|
|
93
94
|
"husky": "^8.0.1",
|
94
95
|
"istanbul": "^0.4.5",
|
95
96
|
"lint-staged": "13.0.3",
|
97
|
+
"madge": "^5.0.1",
|
96
98
|
"mocha": "^10.0.0",
|
97
99
|
"mocha-lcov-reporter": "^1.3.0",
|
98
100
|
"moment": "^2.29.4",
|