Skip to content

Commit

Permalink
Only send heartbeat when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
eandersson committed Jul 11, 2016
1 parent 57677f3 commit 12399d9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
2 changes: 1 addition & 1 deletion amqpstorm/channel0.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def on_frame(self, frame_in):
"""
LOGGER.debug('Frame Received: %s', frame_in.name)
if frame_in.name == 'Heartbeat':
self.send_heartbeat()
return
elif frame_in.name == 'Connection.Start':
self.server_properties = frame_in.server_properties
self._send_start_ok_frame(frame_in)
Expand Down
5 changes: 0 additions & 5 deletions amqpstorm/tests/channel0_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,8 @@ def test_channel0_heartbeat(self):
connection = amqpstorm.Connection('localhost', 'guest', 'guest',
lazy=True)
channel = Channel0(connection)

self.assertEqual(connection.heartbeat._writes_since_check, 0)

channel.on_frame(Heartbeat())

self.assertEqual(connection.heartbeat._writes_since_check, 1)

def test_channel0_is_blocked(self):
connection = amqpstorm.Connection('localhost', 'guest', 'guest',
lazy=True)
Expand Down

0 comments on commit 12399d9

Please sign in to comment.