Skip to content
Snippets Groups Projects
Commit 2c4a364e authored by Noah Eisen's avatar Noah Eisen Committed by GitHub
Browse files

Merge pull request #9286 from ncteisen/python-stress-wait-for-ready

Modify Python Stress Client to Wait for Ready
parents a3960b98 d70c8bb8
No related branches found
No related tags found
No related merge requests found
......@@ -68,12 +68,8 @@ class BenchmarkClient:
else:
channel = grpc.insecure_channel(server)
connected_event = threading.Event()
def wait_for_ready(connectivity):
if connectivity == grpc.ChannelConnectivity.READY:
connected_event.set()
channel.subscribe(wait_for_ready, try_to_connect=True)
connected_event.wait()
# waits for the channel to be ready before we start sending messages
grpc.channel_ready_future(channel).result()
if config.payload_config.WhichOneof('payload') == 'simple_params':
self._generic = False
......
......@@ -110,10 +110,13 @@ def _get_channel(target, args):
channel_credentials = grpc.ssl_channel_credentials(
root_certificates=root_certificates)
options = (('grpc.ssl_target_name_override', args.server_host_override,),)
return grpc.secure_channel(
target, channel_credentials, options=options)
channel = grpc.secure_channel(target, channel_credentials, options=options)
else:
return grpc.insecure_channel(target)
channel = grpc.insecure_channel(target)
# waits for the channel to be ready before we start sending messages
grpc.channel_ready_future(channel).result()
return channel
def run_test(args):
test_cases = _parse_weighted_test_cases(args.test_cases)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment