diff options
author | Jürg Billeter <j@bitron.ch> | 2018-09-24 10:03:36 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2018-09-30 08:41:13 +0200 |
commit | 01831afe4cf367c56fdee5c6c59fa426e2829a78 (patch) | |
tree | 858a3dfe6305f1901156d274b1b2e50119294b1a /buildstream | |
parent | 2d025076cf20060c6ad6007a1a2c3603b72d3fef (diff) | |
download | buildstream-01831afe4cf367c56fdee5c6c59fa426e2829a78.tar.gz |
_artifactcache/cascache.py: Increase payload size limit for uploads
gRPC can handle 1 MiB payloads. Increase size limit from 64 KiB to speed
up uploads.`
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/_artifactcache/cascache.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/buildstream/_artifactcache/cascache.py b/buildstream/_artifactcache/cascache.py index 619613a41..7360d548e 100644 --- a/buildstream/_artifactcache/cascache.py +++ b/buildstream/_artifactcache/cascache.py @@ -43,6 +43,11 @@ from .._exceptions import ArtifactError from . import ArtifactCache +# The default limit for gRPC messages is 4 MiB. +# Limit payload to 1 MiB to leave sufficient headroom for metadata. +_MAX_PAYLOAD_BYTES = 1024 * 1024 + + # A CASCache manages artifacts in a CAS repository as specified in the # Remote Execution API. # @@ -330,12 +335,12 @@ class CASCache(ArtifactCache): finished = False remaining = digest.size_bytes while not finished: - chunk_size = min(remaining, 64 * 1024) + chunk_size = min(remaining, _MAX_PAYLOAD_BYTES) remaining -= chunk_size request = bytestream_pb2.WriteRequest() request.write_offset = offset - # max. 64 kB chunks + # max. _MAX_PAYLOAD_BYTES chunks request.data = f.read(chunk_size) request.resource_name = resname request.finish_write = remaining <= 0 |