This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch valentindavid/handle_grpc_unavailable in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 8610a8a4de3480c4fb1fbb657b37b475da8174ec Author: Valentin David <[email protected]> AuthorDate: Thu Dec 6 10:28:08 2018 +0100 Handle grpc.StatusCode.UNAVAILABLE in first request in case connect() fails This should allow retrying. CAS cache server seems to not accept connections in time. --- buildstream/_artifactcache/cascache.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index 9ca757d..ac7c5fb 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -1199,8 +1199,12 @@ class CASRemote(): if 0 < server_max_batch_total_size_bytes < self.max_batch_total_size_bytes: self.max_batch_total_size_bytes = server_max_batch_total_size_bytes except grpc.RpcError as e: - # Simply use the defaults for servers that don't implement GetCapabilities() - if e.code() != grpc.StatusCode.UNIMPLEMENTED: + if e.code() == grpc.StatusCode.UNIMPLEMENTED: + # Simply use the defaults for servers that don't implement GetCapabilities() + pass + elif e.code() == grpc.StatusCode.UNAVAILABLE: + raise CASError("Failed to connect to CAS service: {}".format(e.details())) from e + else: raise # Check whether the server supports BatchReadBlobs()
