Skip to content

Commit 574761d

Browse files
Refactor #414
1 parent 40aa260 commit 574761d

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

lib/hutch/broker.rb

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
require 'hutch/logging'
55
require 'hutch/exceptions'
66
require 'hutch/publisher'
7-
require 'thread'
87

98
module Hutch
109
class Broker
@@ -127,16 +126,12 @@ def install_channel_recovery!(ch)
127126
ch.on_error do |channel, close|
128127
next unless close.delivery_ack_timeout?
129128

130-
# Reopen performs blocking protocol operations, so run it outside Bunny's
131-
# channel error callback thread to avoid timing out waiting for OpenOk.
132-
Thread.new do
133-
begin
134-
channel.reopen
135-
connection.recover_channel_topology(channel)
136-
logger.info 'channel recovery succeeded'
137-
rescue => ex
138-
logger.error "channel recovery failed: #{ex.class}: #{ex.message}"
139-
end
129+
begin
130+
channel.reopen
131+
connection.recover_channel_topology(channel)
132+
logger.warn 'recovered consumer channel after a delivery acknowledgement timeout'
133+
rescue => ex
134+
logger.error "channel recovery failed: #{ex.class}: #{ex.message}"
140135
end
141136
end
142137
end

0 commit comments

Comments
 (0)