diff --git a/kafka/coordinator/base.py b/kafka/coordinator/base.py index 421360eab..5cdbdcfea 100644 --- a/kafka/coordinator/base.py +++ b/kafka/coordinator/base.py @@ -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):