Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use log level warn instead of error ... #531

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/bunny/reader_loop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ def run_loop
rescue AMQ::Protocol::EmptyResponseError, IOError, SystemCallError, Timeout::Error => e
break if terminate? || @session.closing? || @session.closed?

log_exception(e)
@network_is_down = true
if @session.automatically_recover?
log_exception(e, level: :warn)
@session.handle_network_failure(e)
else
log_exception(e)
@session_thread.raise(Bunny::NetworkFailure.new("detected a network failure: #{e.message}", e))
end
rescue ShutdownSignal => _
Expand Down Expand Up @@ -122,12 +123,12 @@ def kill

protected

def log_exception(e)
def log_exception(e, level: :error)
if !(io_error?(e) && (@session.closing? || @session.closed?))
@logger.error "Exception in the reader loop: #{e.class.name}: #{e.message}"
@logger.error "Backtrace: "
@logger.send level, "Exception in the reader loop: #{e.class.name}: #{e.message}"
@logger.send level, "Backtrace: "
e.backtrace.each do |line|
@logger.error "\t#{line}"
@logger.send level, "\t#{line}"
end
end
end
Expand Down