enhance: allow uses to disable broker heartbeats by not providing a timeout

This commit is contained in:
smart-programmer 2024-05-12 22:27:27 +03:00 committed by Asif Saif Uddin
parent eae75855e0
commit cddc500fd2
1 changed files with 5 additions and 4 deletions

View File

@ -195,9 +195,10 @@ class ConsumerMixin:
try:
conn.drain_events(timeout=safety_interval)
except socket.timeout:
if timeout:
conn.heartbeat_check()
elapsed += safety_interval
if timeout and elapsed >= timeout:
if elapsed >= timeout:
raise
except OSError:
if not self.should_stop: