bullmq 1.52.0 → 1.52.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/commands/cleanJobsInSet-1.lua +23 -8
- package/package.json +4 -2
- package/dist/bullmq.d.ts +0 -1562
- package/dist/tsdoc-metadata.json +0 -11
@@ -11,6 +11,7 @@
|
|
11
11
|
|
12
12
|
TODO: emit a "cleaned" global event.
|
13
13
|
]]
|
14
|
+
local rcall = redis.call
|
14
15
|
local command = "ZRANGE"
|
15
16
|
local isList = false
|
16
17
|
|
@@ -19,10 +20,24 @@ if ARGV[4] == "wait" or ARGV[4] == "active" or ARGV[4] == "paused" then
|
|
19
20
|
isList = true
|
20
21
|
end
|
21
22
|
|
22
|
-
local
|
23
|
+
local rangeStart = 0
|
24
|
+
local rangeEnd = -1
|
25
|
+
|
26
|
+
local limit = tonumber(ARGV[3])
|
27
|
+
|
28
|
+
-- If we're only deleting _n_ items, avoid retrieving all items
|
29
|
+
-- for faster performance
|
30
|
+
--
|
31
|
+
-- Start from the tail of the list, since that's where oldest elements
|
32
|
+
-- are generally added for FIFO lists
|
33
|
+
if limit > 0 then
|
34
|
+
rangeStart = -1 - limit + 1
|
35
|
+
rangeEnd = -1
|
36
|
+
end
|
37
|
+
|
38
|
+
local jobs = rcall(command, KEYS[1], 0, -1)
|
23
39
|
local deleted = {}
|
24
40
|
local deletedCount = 0
|
25
|
-
local limit = tonumber(ARGV[3])
|
26
41
|
local jobTS
|
27
42
|
for _, job in ipairs(jobs) do
|
28
43
|
if limit > 0 and deletedCount >= limit then
|
@@ -30,16 +45,16 @@ for _, job in ipairs(jobs) do
|
|
30
45
|
end
|
31
46
|
|
32
47
|
local jobKey = ARGV[1] .. job
|
33
|
-
if (
|
34
|
-
jobTS =
|
48
|
+
if (rcall("EXISTS", jobKey .. ":lock") == 0) then
|
49
|
+
jobTS = rcall("HGET", jobKey, "timestamp")
|
35
50
|
if (not jobTS or jobTS < ARGV[2]) then
|
36
51
|
if isList then
|
37
|
-
|
52
|
+
rcall("LREM", KEYS[1], 0, job)
|
38
53
|
else
|
39
|
-
|
54
|
+
rcall("ZREM", KEYS[1], job)
|
40
55
|
end
|
41
|
-
|
42
|
-
|
56
|
+
rcall("DEL", jobKey)
|
57
|
+
rcall("DEL", jobKey .. ":logs")
|
43
58
|
deletedCount = deletedCount + 1
|
44
59
|
table.insert(deleted, job)
|
45
60
|
end
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "bullmq",
|
3
|
-
"version": "1.52.
|
3
|
+
"version": "1.52.1",
|
4
4
|
"description": "Queue for messages and jobs based on Redis",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -18,7 +18,8 @@
|
|
18
18
|
"dist"
|
19
19
|
],
|
20
20
|
"scripts": {
|
21
|
-
"build": "npm-run-all tsc copy:lua copy:includes:lua",
|
21
|
+
"build": "npm-run-all tsc copy:lua copy:includes:lua clean:temp:files",
|
22
|
+
"clean:temp:files": "rimraf dist/bullmq.d.ts dist/tsdoc-metadata.json",
|
22
23
|
"copy:lua": "copyfiles -f ./src/commands/*.lua ./dist/commands",
|
23
24
|
"copy:includes:lua": "copyfiles -f ./src/commands/includes/*.lua ./dist/commands/includes",
|
24
25
|
"coverage": "nyc --reporter=text npm run test",
|
@@ -96,6 +97,7 @@
|
|
96
97
|
"nyc": "^14.1.1",
|
97
98
|
"prettier": "^2.4.1",
|
98
99
|
"pretty-quick": "^3.1.1",
|
100
|
+
"rimraf": "^3.0.2",
|
99
101
|
"semantic-release": "^17.4.7",
|
100
102
|
"sinon": "^7.5.0",
|
101
103
|
"test-console": "^2.0.0",
|