summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildstream/_artifactcache/cascache.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py
index 4f0d10da5..d7656521d 100644
--- a/buildstream/_artifactcache/cascache.py
+++ b/buildstream/_artifactcache/cascache.py
@@ -48,6 +48,9 @@ from . import ArtifactCache
# Limit payload to 1 MiB to leave sufficient headroom for metadata.
_MAX_PAYLOAD_BYTES = 1024 * 1024
+# How often is a keepalive ping sent to the server to make sure the transport is still alive
+_KEEPALIVE_TIME_MS = 60000
+
class _Attempt():
@@ -1104,7 +1107,8 @@ class _CASRemote():
url = urlparse(self.spec.url)
if url.scheme == 'http':
port = url.port or 80
- self.channel = grpc.insecure_channel('{}:{}'.format(url.hostname, port))
+ self.channel = grpc.insecure_channel('{}:{}'.format(url.hostname, port),
+ options=[("grpc.keepalive_time_ms", _KEEPALIVE_TIME_MS)])
elif url.scheme == 'https':
port = url.port or 443
@@ -1129,7 +1133,8 @@ class _CASRemote():
credentials = grpc.ssl_channel_credentials(root_certificates=server_cert_bytes,
private_key=client_key_bytes,
certificate_chain=client_cert_bytes)
- self.channel = grpc.secure_channel('{}:{}'.format(url.hostname, port), credentials)
+ self.channel = grpc.secure_channel('{}:{}'.format(url.hostname, port), credentials,
+ options=[("grpc.keepalive_time_ms", _KEEPALIVE_TIME_MS)])
else:
raise ArtifactError("Unsupported URL: {}".format(self.spec.url))