summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/execution_service/execution_server.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-07-31 17:35:48 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-08-07 14:43:19 +0200
commit74fbd57a3afabc04f594889e092cc735a1788346 (patch)
tree44f8768127a7cbc40b06722e9b3416a9a1ebe24e /src/buildtool/execution_api/execution_service/execution_server.cpp
parent3188fb1a9b0e967969a3a7953923bcf94247bc09 (diff)
downloadjustbuild-74fbd57a3afabc04f594889e092cc735a1788346.tar.gz
Remove ExecutionServiceImpl::StoreActionResult method
...and move the storing logic to Execute directly. There is no need to pass additional parameters to the method to just perform a check inside, and after this removal there is no need to preserve a one-line method.
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.cpp')
-rw-r--r--src/buildtool/execution_api/execution_service/execution_server.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp
index e0685315..9e34d321 100644
--- a/src/buildtool/execution_api/execution_service/execution_server.cpp
+++ b/src/buildtool/execution_api/execution_service/execution_server.cpp
@@ -288,22 +288,6 @@ auto ExecutionServiceImpl::GetResponse(
return std::move(response);
}
-auto ExecutionServiceImpl::StoreActionResult(
- ::bazel_re::ExecuteRequest const* request,
- IExecutionResponse::Ptr const& i_execution_response,
- ::bazel_re::ExecuteResponse const& execute_response,
- ::bazel_re::Action const& action) const noexcept
- -> expected<std::monostate, std::string> {
- if (i_execution_response->ExitCode() == 0 and not action.do_not_cache() and
- not storage_.ActionCache().StoreResult(request->action_digest(),
- execute_response.result())) {
- auto str = fmt::format("Could not store action result for action {}",
- request->action_digest().hash());
- logger_.Emit(LogLevel::Error, "{}", str);
- return unexpected{std::move(str)};
- }
- return std::monostate{};
-}
void ExecutionServiceImpl::WriteResponse(
::bazel_re::ExecuteResponse const& execute_response,
::grpc::ServerWriter<::google::longrunning::Operation>* writer,
@@ -365,12 +349,18 @@ auto ExecutionServiceImpl::Execute(
std::move(execute_response).error()};
}
- auto store_result = StoreActionResult(
- request, i_execution_response, *execute_response, *action);
- if (not store_result) {
- return ::grpc::Status{grpc::StatusCode::INTERNAL,
- std::move(store_result).error()};
+ if (i_execution_response->ExitCode() == 0 and not action->do_not_cache()) {
+ if (not storage_.ActionCache().StoreResult(
+ request->action_digest(), execute_response->result())) {
+ auto const str =
+ fmt::format("Could not store action result for action {}",
+ request->action_digest().hash());
+
+ logger_.Emit(LogLevel::Error, str);
+ return ::grpc::Status{grpc::StatusCode::INTERNAL, str};
+ }
}
+
WriteResponse(*execute_response, writer, &op);
return ::grpc::Status::OK;
}