Skip to content

Commit

Permalink
Return float(inf) seconds instead of sys.maxsize int in coordinator t…
Browse files Browse the repository at this point in the history
…ime to next poll()
  • Loading branch information
dpkp committed Sep 28, 2019
1 parent 2f713cf commit 2997a57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kafka/coordinator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,14 @@ def poll_heartbeat(self):
self.heartbeat.poll()

def time_to_next_heartbeat(self):
"""Returns seconds (float) remaining before next heartbeat should be sent
Note: Returns infinite if group is not joined
"""
with self._lock:
# if we have not joined the group, we don't need to send heartbeats
if self.state is MemberState.UNJOINED:
return sys.maxsize
return float('inf')
return self.heartbeat.time_to_next_heartbeat()

def _handle_join_success(self, member_assignment_bytes):
Expand Down

0 comments on commit 2997a57

Please sign in to comment.