diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-09-13 13:22:26 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-09-16 10:01:34 +0200 |
commit | e55a09d01d4daad62f366f01b443585e373c4266 (patch) | |
tree | 460743dab47a23acacb93e964863d92a4c09ce62 /src | |
parent | a9ec80795740dd33a1bcf18f43e30f473bf90dc7 (diff) | |
download | justbuild-e55a09d01d4daad62f366f01b443585e373c4266.tar.gz |
bazel_execution_client: Remove duplication of error messages
...during WithRetry, as we know that the error message of the
callable has already been appropriately logged.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp index 300e3dcd..c9b1ffe1 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_execution_client.cpp @@ -90,20 +90,19 @@ auto BazelExecutionClient::Execute(std::string const& instance_name, std::unique_ptr<grpc::ClientReader<google::longrunning::Operation>> reader(stub_->Execute(&context, request)); - auto [op, fatal, error_msg] = ReadExecution(reader.get(), wait); + auto [op, fatal, _] = ReadExecution(reader.get(), wait); if (not op.has_value()) { - return { - .ok = false, .exit_retry_loop = fatal, .error_msg = error_msg}; + return {.ok = false, .exit_retry_loop = fatal}; } auto contents = ExtractContents(std::move(op)); response = contents.response; if (response.state == ExecutionResponse::State::Finished) { return {.ok = true}; } + auto const is_fatal = response.state != ExecutionResponse::State::Retry; return {.ok = false, - .exit_retry_loop = - response.state != ExecutionResponse::State::Retry, - .error_msg = contents.error_msg}; + .exit_retry_loop = is_fatal, + .error_msg = is_fatal ? std::nullopt : contents.error_msg}; }; if (not WithRetry(execute, retry_config_, logger_)) { logger_.Emit(LogLevel::Error, @@ -125,21 +124,19 @@ auto BazelExecutionClient::WaitExecution(std::string const& execution_handle) std::unique_ptr<grpc::ClientReader<google::longrunning::Operation>> reader(stub_->WaitExecution(&context, request)); - auto [op, fatal, error_msg] = - ReadExecution(reader.get(), /*wait=*/true); + auto [op, fatal, _] = ReadExecution(reader.get(), /*wait=*/true); if (not op.has_value()) { - return { - .ok = false, .exit_retry_loop = fatal, .error_msg = error_msg}; + return {.ok = false, .exit_retry_loop = fatal}; } auto contents = ExtractContents(std::move(op)); response = contents.response; if (response.state == ExecutionResponse::State::Finished) { return {.ok = true}; } + auto const is_fatal = response.state != ExecutionResponse::State::Retry; return {.ok = false, - .exit_retry_loop = - response.state != ExecutionResponse::State::Retry, - .error_msg = contents.error_msg}; + .exit_retry_loop = is_fatal, + .error_msg = is_fatal ? std::nullopt : contents.error_msg}; }; if (not WithRetry(wait_execution, retry_config_, logger_)) { logger_.Emit( |