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
committerDana Powers <dana.powers@gmail.com>2019-05-28 23:45:48 -0700
commit0ac7b6c144907df1481d55085fc81b784f20bd27 (patch)
treec25496928c9d5e3f1a4fe89256ad6505443708a2 /kafka/client_async.py
parentf6a8a38937688ea2cc5dc13d3d1039493be5c9b5 (diff)
downloadkafka-python-no_ifrs_short_poll.tar.gz
Reduce client poll timeout when no ifrsno_ifrs_short_poll
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)