Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Disable heartbeats by default
Browse files Browse the repository at this point in the history
  • Loading branch information
oldpatricka committed Jan 7, 2013
1 parent 921a5ba commit b678e92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion dashi/__init__.py
Expand Up @@ -17,7 +17,7 @@

log = logging.getLogger(__name__)

DEFAULT_HEARTBEAT = 30
DEFAULT_HEARTBEAT = None # Disabled for now

class DashiConnection(object):

Expand Down Expand Up @@ -295,6 +295,9 @@ def _consume_one(self, timeout=None):
inner_timeout = timeout - elapsed

def heartbeat(self):
if self._dashi._heartbeat_interval is None:
return

time_between_tics = timedelta(seconds=self._dashi._heartbeat_interval / 2)

if self._dashi.consumer_timeout > time_between_tics.seconds:
Expand Down
2 changes: 1 addition & 1 deletion dashi/tests/test_dashi.py
Expand Up @@ -372,7 +372,7 @@ def test_handle_sender_kwarg(self):
def test_heartbeats(self):

receiver = TestReceiver(uri=self.uri, exchange="x1",
transport_options=self.transport_options)
transport_options=self.transport_options, heartbeat=30)
receiver.conn.consumer_timeout = 100

receiver.handle("test1", "hello", sender_kwarg="sender")
Expand Down

0 comments on commit b678e92

Please sign in to comment.