diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-07-29 14:09:54 +0200 |
---|---|---|
committer | Sascha Roloff <sascha.roloff@huawei.com> | 2022-08-05 14:41:31 +0200 |
commit | f30bdb53d39d62d42f70762a6ef9afb273e57c71 (patch) | |
tree | fd93aac4d1ac1abef8b9863d0c990f4aa5189ea1 /src | |
parent | 357bc8fc0aca5780eb4d346f54fabdee71f3a6f7 (diff) | |
download | justbuild-f30bdb53d39d62d42f70762a6ef9afb273e57c71.tar.gz |
BazelNetwork: Use bytestream for reading unknown size blobs
... otherwise actual blob size might exceed the maximum
transfer size of the CAS client. Therefore, we always have
to use the bytestream client if the size is unknown.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_network.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp index a5574c77..bdb4f3be 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_network.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_network.cpp @@ -191,8 +191,11 @@ auto BazelNetwork::BlobReader::Next() noexcept -> std::vector<BazelBlob> { std::vector<BazelBlob> blobs{}; while (current_ != ids_.end()) { - size += gsl::narrow<std::size_t>(current_->size_bytes()); - if (size > kMaxBatchTransferSize) { + auto blob_size = gsl::narrow<std::size_t>(current_->size_bytes()); + size += blob_size; + // read if size is 0 (unknown) or exceeds transfer size + if (blob_size == 0 or size > kMaxBatchTransferSize) { + // perform read of range [begin_, current_) if (begin_ == current_) { auto blob = cas_->ReadSingleBlob(instance_name_, *begin_); if (blob) { |