summaryrefslogtreecommitdiff
path: root/kafka/client_async.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2019-05-28 23:45:48 -0700
committerJeff Widman <jeff@jeffwidman.com>2019-05-29 21:46:37 -0700
commit9f0b518286ecfc6db8b7abbd2431810c16f1cc80 (patch)
tree81f210c3d6de3d21b5a00d8dded3d8128b3fdd2e /kafka/client_async.py
parent5bb1abd3495ce81a0522b2a66e6c5d2731dae77b (diff)
downloadkafka-python-9f0b518286ecfc6db8b7abbd2431810c16f1cc80.tar.gz
Reduce client poll timeout when no ifrs
Diffstat (limited to 'kafka/client_async.py')
-rw-r--r--kafka/client_async.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/kafka/client_async.py b/kafka/client_async.py
index 77efac8..42ec42b 100644
--- a/kafka/client_async.py
+++ b/kafka/client_async.py
@@ -588,6 +588,9 @@ class KafkaClient(object):
metadata_timeout_ms,
idle_connection_timeout_ms,
self.config['request_timeout_ms'])
+ # if there are no requests in flight, do not block longer than the retry backoff
+ if self.in_flight_request_count() == 0:
+ timeout = min(timeout, self.config['retry_backoff_ms'])
timeout = max(0, timeout / 1000) # avoid negative timeouts
self._poll(timeout)