Skip to content

Commit

Permalink
Allow disabling thread wakeup in send_request_to_node (dpkp#2335)
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhan289 authored and hiwakaba committed Jul 13, 2023
1 parent 4d59805 commit 790e1c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kafka/admin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,21 +355,22 @@ def _find_coordinator_ids(self, group_ids):
}
return groups_coordinators

def _send_request_to_node(self, node_id, request):
def _send_request_to_node(self, node_id, request, wakeup=True):
"""Send a Kafka protocol message to a specific broker.
Returns a future that may be polled for status and results.
:param node_id: The broker id to which to send the message.
:param request: The message to send.
:param wakeup: Optional flag to disable thread-wakeup.
:return: A future object that may be polled for status and results.
:exception: The exception if the message could not be sent.
"""
while not self._client.ready(node_id):
# poll until the connection to broker is ready, otherwise send()
# will fail with NodeNotReadyError
self._client.poll()
return self._client.send(node_id, request)
return self._client.send(node_id, request, wakeup)

def _send_request_to_controller(self, request):
"""Send a Kafka protocol message to the cluster controller.
Expand Down

0 comments on commit 790e1c9

Please sign in to comment.