diff options
author | ncteisen <ncteisen@gmail.com> | 2017-01-10 11:58:40 -0800 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2017-01-10 11:59:28 -0800 |
commit | d70c8bb871c68d8d8fd96660236c96e48d71c00a (patch) | |
tree | 60087e5fa9e37d76f8c3a9729828c78e3ed59111 /src/python/grpcio_tests/tests/qps | |
parent | a3960b98d6a1b85a1e3b89cd7797a509505fa207 (diff) |
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.
Diffstat (limited to 'src/python/grpcio_tests/tests/qps')
-rw-r--r-- | src/python/grpcio_tests/tests/qps/benchmark_client.py | 8 |
1 files changed, 2 insertions, 6 deletions
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 |