Skip to content

Commit 0cb963c

Browse files
committed
Fix health check.
1 parent cd63b8d commit 0cb963c

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

lib/async/job/adapter/active_job/dispatcher.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,12 @@ def keys
6262
end
6363

6464
def status_string
65-
@queues.map do |name, queue|
66-
if queue.respond_to?(:status_string)
67-
"#{name} (#{queue.status_string})"
65+
self.keys.map do |name|
66+
queue = @queues[name]
67+
server = queue&.server
68+
69+
if server&.respond_to?(:status_string)
70+
"#{name} #{server.status_string}"
6871
else
6972
name
7073
end

lib/async/job/adapter/active_job/service.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ def setup(container)
2929

3030
instance.ready!
3131

32-
if health_check_timeout
33-
Async(transient: true) do
34-
while true
35-
instance.name = "#{self.name} (#{dispatcher.status_string})"
36-
sleep(health_check_timeout / 2)
37-
instance.ready!
32+
Sync do |task|
33+
if health_check_timeout
34+
Async(transient: true) do
35+
while true
36+
instance.name = "#{self.name} (#{dispatcher.status_string})"
37+
sleep(health_check_timeout / 2)
38+
instance.ready!
39+
end
3840
end
3941
end
40-
end
41-
42-
Sync do |task|
42+
4343
barrier = Async::Barrier.new
4444

4545
# Start all the named queues:

0 commit comments

Comments
 (0)