File tree 1 file changed +9
-5
lines changed
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -252,12 +252,16 @@ def ensure_coordinator_ready(self, timeout_ms=None):
252
252
# so we will just pick a node at random and treat
253
253
# it as the "coordinator"
254
254
if self .config ['api_version' ] < (0 , 8 , 2 ):
255
- self .coordinator_id = self ._client .least_loaded_node ()
256
- if self .coordinator_id is not None :
255
+ maybe_coordinator_id = self ._client .least_loaded_node ()
256
+ if maybe_coordinator_id is None or self ._client .cluster .is_bootstrap (maybe_coordinator_id ):
257
+ future = Future ().failure (Errors .NoBrokersAvailable ())
258
+ else :
259
+ self .coordinator_id = maybe_coordinator_id
257
260
self ._client .maybe_connect (self .coordinator_id )
258
- continue
261
+ continue
262
+ else :
263
+ future = self .lookup_coordinator ()
259
264
260
- future = self .lookup_coordinator ()
261
265
self ._client .poll (future = future , timeout_ms = inner_timeout_ms ())
262
266
263
267
if not future .is_done :
@@ -677,7 +681,7 @@ def _send_group_coordinator_request(self):
677
681
Future: resolves to the node id of the coordinator
678
682
"""
679
683
node_id = self ._client .least_loaded_node ()
680
- if node_id is None :
684
+ if node_id is None or self . _client . cluster . is_bootstrap ( node_id ) :
681
685
return Future ().failure (Errors .NoBrokersAvailable ())
682
686
683
687
elif not self ._client .ready (node_id , metadata_priority = False ):
You can’t perform that action at this time.
0 commit comments