lib/bunny/session.rb in bunny-1.6.2 vs lib/bunny/session.rb in bunny-1.6.3
- old
+ new
@@ -997,10 +997,16 @@
@logger.debug "Heartbeat interval negotiation: client = #{@client_heartbeat}, server = #{connection_tune.heartbeat}, result = #{@heartbeat}"
@logger.info "Heartbeat interval used (in seconds): #{@heartbeat}"
# We set the read_write_timeout to twice the heartbeat value
# This allows us to miss a single heartbeat before we time out the socket.
- @transport.read_timeout = @heartbeat * 2
+ @transport.read_timeout = if heartbeat_disabled?(@client_heartbeat)
+ Transport::DEFAULT_READ_TIMEOUT
+ else
+ # pad to account for edge cases. MK.
+ @heartbeat * 2.2
+ end
+
# if there are existing channels we've just recovered from
# a network failure and need to fix the allocated set. See issue 205. MK.
if @channels.empty?
@channel_id_allocator = ChannelIdAllocator.new(@channel_max)