@@ -8,12 +8,12 @@ module Job
8
8
module Processor
9
9
module Redis
10
10
class ProcessingList
11
- REPROCESSOR = <<~LUA
11
+ REQUEUE = <<~LUA
12
12
local cursor = "0"
13
13
local count = 0
14
14
15
15
repeat
16
- -- Scan through all known server id -> job id mappings and reprocessor any jobs that have been abandoned:
16
+ -- Scan through all known server id -> job id mappings and requeue any jobs that have been abandoned:
17
17
local result = redis.call('SCAN', cursor, 'MATCH', KEYS[1]..':*:pending')
18
18
cursor = result[1]
19
19
for _, pending_key in pairs(result[2]) do
@@ -22,7 +22,7 @@ class ProcessingList
22
22
local state = redis.call('GET', server_key)
23
23
if state == false then
24
24
while true do
25
- -- Reprocessor any pending jobs:
25
+ -- Requeue any pending jobs:
26
26
local result = redis.call('RPOPLPUSH', pending_key, KEYS[2])
27
27
28
28
if result == false then
@@ -61,7 +61,7 @@ def initialize(client, key, id, ready_list, job_store)
61
61
@pending_key = "#{ @key } :#{ @id } :pending"
62
62
@heartbeat_key = "#{ @key } :#{ @id } "
63
63
64
- @reprocessor = @client . script ( :load , REPROCESSOR )
64
+ @requeue = @client . script ( :load , REQUEUE )
65
65
@retry = @client . script ( :load , RETRY )
66
66
@complete = @client . script ( :load , COMPLETE )
67
67
end
@@ -86,17 +86,15 @@ def start(delay: 5, factor: 2, parent: Async::Task.current)
86
86
heartbeat_key = "#{ @key } :#{ @id } "
87
87
start_time = Time . now . to_f
88
88
89
- Console . info ( self , "Starting processing processor..." , key : @key , id : @id , heartbeat_key : heartbeat_key , delay : delay , factor : factor )
90
-
91
89
parent . async do
92
90
while true
93
91
uptime = ( Time . now . to_f - start_time ) . round ( 2 )
94
92
@client . set ( heartbeat_key , JSON . dump ( uptime : uptime ) , seconds : delay *factor )
95
93
96
- # Reprocessor any jobs that have been abandoned:
97
- count = @client . evalsha ( @reprocessor , 2 , @key , @ready_list . key )
94
+ # REQUEUE any jobs that have been abandoned:
95
+ count = @client . evalsha ( @requeue , 2 , @key , @ready_list . key )
98
96
if count > 0
99
- Console . warn ( self , "Reprocessord #{ count } abandoned jobs." )
97
+ Console . warn ( self , "Requeued #{ count } abandoned jobs." )
100
98
end
101
99
102
100
sleep ( delay )
0 commit comments