Skip to content

Commit 734605d

Browse files
committed
Send heartbeat frames more often
The AMQP protocol is saying that we should send "two" "heartbeat frames" during the "heartbeat timeout" (see [1] and rabbit implement this in [2]). The "two" value is the "rate" parameter in the current implementation. The current implementation was sending only one frame during the "heartbeat timeout", which is wrong. [1] https://www.amqp.org/specification/0-9-1/amqp-org-download [2] https://www.rabbitmq.com/heartbeats.html#heartbeats-interval Signed-off-by: Arnaud Morin <[email protected]>
1 parent 9d7b36a commit 734605d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

amqp/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ def heartbeat_tick(self, rate=2):
754754
self.prev_sent, self.prev_recv = sent_now, recv_now
755755

756756
# send a heartbeat if it's time to do so
757-
if now > self.last_heartbeat_sent + self.heartbeat:
757+
if now > self.last_heartbeat_sent + self.heartbeat / rate:
758758
AMQP_HEARTBEAT_LOGGER.debug(
759759
'heartbeat_tick: sending heartbeat for connection %s',
760760
self._connection_id)

0 commit comments

Comments
 (0)