diff options
author | Dana Powers <dana.powers@gmail.com> | 2019-06-19 13:41:59 -0700 |
---|---|---|
committer | Jeff Widman <jeff@jeffwidman.com> | 2019-06-19 13:41:59 -0700 |
commit | 91f4642e92afc208531f66cea1ed7ef32bcfa4d1 (patch) | |
tree | 82e08036d43a297c865d4766b4198bac951ee9bb /kafka/coordinator/base.py | |
parent | f126e5bfcc8f41ee5ea29b41ec6eabbc3f441647 (diff) | |
download | kafka-python-91f4642e92afc208531f66cea1ed7ef32bcfa4d1.tar.gz |
Use dedicated connection for group coordinator (#1822)
This changes the coordinator_id to be a unique string, e.g., `coordinator-1`, so that it will get a dedicated connection. This won't eliminate lock contention because the client lock applies to all connections, but it should improve in-flight-request contention.
Diffstat (limited to 'kafka/coordinator/base.py')
-rw-r--r-- | kafka/coordinator/base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kafka/coordinator/base.py b/kafka/coordinator/base.py index e538fda..421360e 100644 --- a/kafka/coordinator/base.py +++ b/kafka/coordinator/base.py @@ -676,14 +676,14 @@ class BaseCoordinator(object): error_type = Errors.for_code(response.error_code) if error_type is Errors.NoError: with self._client._lock, self._lock: - ok = self._client.cluster.add_group_coordinator(self.group_id, response) - if not ok: + coordinator_id = self._client.cluster.add_group_coordinator(self.group_id, response) + if not coordinator_id: # This could happen if coordinator metadata is different # than broker metadata future.failure(Errors.IllegalStateError()) return - self.coordinator_id = response.coordinator_id + self.coordinator_id = coordinator_id log.info("Discovered coordinator %s for group %s", self.coordinator_id, self.group_id) self._client.maybe_connect(self.coordinator_id) |