bullmq 1.48.1 → 1.48.2
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.
@@ -8,25 +8,26 @@
|
|
8
8
|
KEYS[3] 'delayed'
|
9
9
|
KEYS[4] 'priority'
|
10
10
|
|
11
|
-
ARGV[1] queue key prefix
|
11
|
+
ARGV[1] queue key prefix
|
12
12
|
]]
|
13
13
|
local rcall = redis.call
|
14
|
+
local queueBaseKey = ARGV[1]
|
14
15
|
|
15
|
-
local function
|
16
|
-
for _,
|
17
|
-
rcall("DEL",
|
16
|
+
local function removeJobs (list)
|
17
|
+
for _, id in ipairs(list) do
|
18
|
+
rcall("DEL", queueBaseKey .. id)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
21
22
|
local wait_ids = rcall("LRANGE", KEYS[1] , 0, -1)
|
22
23
|
local paused_ids = rcall("LRANGE", KEYS[2] , 0, -1)
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
removeJobs(wait_ids)
|
26
|
+
removeJobs(paused_ids)
|
26
27
|
|
27
28
|
if KEYS[3] ~= "" then
|
28
29
|
local delayed_ids = rcall("ZRANGE", KEYS[3] , 0, -1)
|
29
|
-
|
30
|
+
removeJobs(delayed_ids)
|
30
31
|
rcall("DEL", KEYS[3])
|
31
32
|
end
|
32
33
|
|
@@ -32,25 +32,26 @@ local function getSetItems(keyName, max)
|
|
32
32
|
return rcall('SMEMBERS', keyName, 0, max)
|
33
33
|
end
|
34
34
|
|
35
|
-
local function removeJobs(
|
35
|
+
local function removeJobs(keys)
|
36
36
|
for i, key in ipairs(keys) do
|
37
|
-
|
38
|
-
rcall("DEL",
|
39
|
-
rcall("DEL",
|
40
|
-
rcall("DEL",
|
37
|
+
local jobKey = baseKey .. key
|
38
|
+
rcall("DEL", jobKey)
|
39
|
+
rcall("DEL", jobKey .. ':logs')
|
40
|
+
rcall("DEL", jobKey .. ':dependencies')
|
41
|
+
rcall("DEL", jobKey .. ':processed')
|
41
42
|
end
|
42
43
|
maxCount = maxCount - #keys
|
43
44
|
end
|
44
45
|
|
45
46
|
local function removeListJobs(keyName, max)
|
46
47
|
local jobs = getListItems(keyName, max)
|
47
|
-
removeJobs(
|
48
|
+
removeJobs(jobs)
|
48
49
|
rcall("LTRIM", keyName, #jobs, -1)
|
49
50
|
end
|
50
51
|
|
51
52
|
local function removeZSetJobs(keyName, max)
|
52
53
|
local jobs = getZSetItems(keyName, max)
|
53
|
-
removeJobs(
|
54
|
+
removeJobs(jobs)
|
54
55
|
if(#jobs > 0) then
|
55
56
|
rcall("ZREM", keyName, unpack(jobs))
|
56
57
|
end
|
@@ -77,7 +78,7 @@ if (#activeJobs > 0) then
|
|
77
78
|
end
|
78
79
|
|
79
80
|
removeLockKeys(activeJobs)
|
80
|
-
removeJobs(
|
81
|
+
removeJobs(activeJobs)
|
81
82
|
rcall("LTRIM", activeKey, #activeJobs, -1)
|
82
83
|
if(maxCount <= 0) then
|
83
84
|
return 1
|