From 791626a28f738c663d36abd3e6f0fc6e6cf0eb32 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Thu, 28 Jan 2021 02:48:48 +0000 Subject: [PATCH] Accept programmatic configuration of RPC timeout --- .../tests_py3_only/interop/xds_interop_client.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/python/grpcio_tests/tests_py3_only/interop/xds_interop_client.py b/src/python/grpcio_tests/tests_py3_only/interop/xds_interop_client.py index 640cb7dbd31..07861a3c3de 100644 --- a/src/python/grpcio_tests/tests_py3_only/interop/xds_interop_client.py +++ b/src/python/grpcio_tests/tests_py3_only/interop/xds_interop_client.py @@ -324,13 +324,22 @@ class _XdsUpdateClientConfigureServicer( metadata = ((md.key, md.value) for md in request.metadata if md.type == method_enum) + # For backward compatibility, do not change timeout when we + # receive a default value timeout. + if request.timeout_secs == 0: + timeout_sec = channel_config.rpc_timeout_sec + else: + timeout_sec = request.timeout_sec else: qps = 0 metadata = () + # Leave timeout unchanged for backward compatibility. + timeout_sec = channel_config.rpc_timeout_sec channel_config = self._per_method_configs[method] with channel_config.condition: channel_config.qps = qps channel_config.metadata = list(metadata) + channel_config.rpc_timeout_sec = timeout_sec channel_config.condition.notify_all() return messages_pb2.ClientConfigureResponse()