Skip to content

Commit 5f05289

Browse files
committed
Fix some words and reduce logging.
1 parent 4d51256 commit 5f05289

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

lib/async/job/processor/redis/delayed_jobs.rb

+1-3
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ def initialize(client, key)
3131
end
3232

3333
def start(ready_list, resolution: 10, parent: Async::Task.current)
34-
Console.info(self, "Starting delayed processor...")
3534
parent.async do
3635
while true
37-
Console.debug(self, "Checking for delayed jobs...")
3836
count = move(destination: ready_list.key)
3937

4038
if count > 0
41-
Console.info(self, "Moved #{count} delayed jobs to ready processor.")
39+
Console.debug(self, "Moved #{count} delayed jobs to ready list.")
4240
end
4341

4442
sleep(resolution)

lib/async/job/processor/redis/processing_list.rb

+7-9
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module Job
88
module Processor
99
module Redis
1010
class ProcessingList
11-
REPROCESSOR = <<~LUA
11+
REQUEUE = <<~LUA
1212
local cursor = "0"
1313
local count = 0
1414
1515
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:
1717
local result = redis.call('SCAN', cursor, 'MATCH', KEYS[1]..':*:pending')
1818
cursor = result[1]
1919
for _, pending_key in pairs(result[2]) do
@@ -22,7 +22,7 @@ class ProcessingList
2222
local state = redis.call('GET', server_key)
2323
if state == false then
2424
while true do
25-
-- Reprocessor any pending jobs:
25+
-- Requeue any pending jobs:
2626
local result = redis.call('RPOPLPUSH', pending_key, KEYS[2])
2727
2828
if result == false then
@@ -61,7 +61,7 @@ def initialize(client, key, id, ready_list, job_store)
6161
@pending_key = "#{@key}:#{@id}:pending"
6262
@heartbeat_key = "#{@key}:#{@id}"
6363

64-
@reprocessor = @client.script(:load, REPROCESSOR)
64+
@requeue = @client.script(:load, REQUEUE)
6565
@retry = @client.script(:load, RETRY)
6666
@complete = @client.script(:load, COMPLETE)
6767
end
@@ -86,17 +86,15 @@ def start(delay: 5, factor: 2, parent: Async::Task.current)
8686
heartbeat_key = "#{@key}:#{@id}"
8787
start_time = Time.now.to_f
8888

89-
Console.info(self, "Starting processing processor...", key: @key, id: @id, heartbeat_key: heartbeat_key, delay: delay, factor: factor)
90-
9189
parent.async do
9290
while true
9391
uptime = (Time.now.to_f - start_time).round(2)
9492
@client.set(heartbeat_key, JSON.dump(uptime: uptime), seconds: delay*factor)
9593

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)
9896
if count > 0
99-
Console.warn(self, "Reprocessord #{count} abandoned jobs.")
97+
Console.warn(self, "Requeued #{count} abandoned jobs.")
10098
end
10199

102100
sleep(delay)

0 commit comments

Comments
 (0)