Skip to content

Commit

Permalink
Don't raise on Upstream Channel Close
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed May 9, 2024
1 parent c993ae7 commit ddf7368
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/amqproxy/upstream.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,11 @@ module AMQProxy
end

def unassign_channel(channel : UInt16)
@channels_lock.synchronize do
if @channels.has_key? channel
send AMQ::Protocol::Frame::Channel::Close.new(channel, 0u16, "", 0u16, 0u16)
@channels.delete channel
end
if @channels_lock.synchronize { @channels.delete(channel) }
send AMQ::Protocol::Frame::Channel::Close.new(channel, 0u16, "", 0u16, 0u16)
end
rescue ex : IO::Error | OpenSSL::SSL::Error
Log.debug(exception: ex) { "Error while closing upstream channel #{id}" }
end

def channels
Expand Down

0 comments on commit ddf7368

Please sign in to comment.