From d70c8bb871c68d8d8fd96660236c96e48d71c00a Mon Sep 17 00:00:00 2001 From: ncteisen Date: Tue, 10 Jan 2017 11:58:40 -0800 Subject: Implement wait-for-ready behavior in Python stress and qps client The clients now block until the channel is in the READY state. This fixes some test flakiness issues we have had. --- src/python/grpcio_tests/tests/qps/benchmark_client.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/python/grpcio_tests/tests/qps/benchmark_client.py') diff --git a/src/python/grpcio_tests/tests/qps/benchmark_client.py b/src/python/grpcio_tests/tests/qps/benchmark_client.py index 83b46c914e..650e4756e7 100644 --- a/src/python/grpcio_tests/tests/qps/benchmark_client.py +++ b/src/python/grpcio_tests/tests/qps/benchmark_client.py @@ -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 -- cgit v1.2.3