Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling thread wakeup in send_request_to_node #2335

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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