summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2016-08-04 18:32:30 -0700
committerDana Powers <dana.powers@gmail.com>2016-08-04 18:32:30 -0700
commitaa07e9ca0dce994c52f25be90bee853aad954d4c (patch)
treef2d42c207d1b777a27ec08f898f9d8ac981b8b33
parentb24a5c25ae77980c9aec197c7efb1cd680a901bc (diff)
downloadkafka-python-drain_pending_coordinator_requests.tar.gz
Drain pending requests to the coordinator before initiating group rejoindrain_pending_coordinator_requests
-rw-r--r--kafka/coordinator/base.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/kafka/coordinator/base.py b/kafka/coordinator/base.py
index e147b6f..5f60aa3 100644
--- a/kafka/coordinator/base.py
+++ b/kafka/coordinator/base.py
@@ -242,6 +242,14 @@ class BaseCoordinator(object):
while self.need_rejoin():
self.ensure_coordinator_known()
+ # ensure that there are no pending requests to the coordinator.
+ # This is important in particular to avoid resending a pending
+ # JoinGroup request.
+ if self._client.in_flight_request_count(self.coordinator_id):
+ while self._client.in_flight_request_count(self.coordinator_id):
+ self._client.poll()
+ continue
+
future = self._send_join_group_request()
self._client.poll(future=future)