diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-10-04 13:52:55 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-10-07 17:51:22 +0200 |
commit | 6d484db9b293aac4b8bd790eb7aead3a806f8c7b (patch) | |
tree | c7a93cef8a95006f217d557300151ce5e8735437 /src/buildtool/execution_api/execution_service/execution_server.cpp | |
parent | 0fc0d9118b5e525fa582de0286c8e83bb0da4e16 (diff) | |
download | justbuild-6d484db9b293aac4b8bd790eb7aead3a806f8c7b.tar.gz |
Enable cppcoreguidelines-* checks.
Diffstat (limited to 'src/buildtool/execution_api/execution_service/execution_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/execution_server.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index cbf61edd..6f77ba3f 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -262,17 +262,17 @@ auto ExecutionServiceImpl::WaitExecution( return ::grpc::Status{::grpc::StatusCode::INVALID_ARGUMENT, str}; } logger_.Emit(LogLevel::Trace, "WaitExecution: {}", hash); - std::optional<::google::longrunning::Operation> op; - do { - op = op_cache_.Query(hash); - if (not op) { - auto const str = fmt::format( - "Executing action {} not found in internal cache.", hash); - logger_.Emit(LogLevel::Error, "{}", str); - return ::grpc::Status{grpc::StatusCode::INTERNAL, str}; - } + auto op = op_cache_.Query(hash); + while (op and not op->done()) { std::this_thread::sleep_for(std::chrono::seconds(1)); - } while (not op->done()); + op = op_cache_.Query(hash); + } + if (not op) { + auto const str = fmt::format( + "Executing action {} not found in internal cache.", hash); + logger_.Emit(LogLevel::Error, "{}", str); + return ::grpc::Status{grpc::StatusCode::INTERNAL, str}; + } writer->Write(*op); logger_.Emit(LogLevel::Trace, "Finished WaitExecution {}", hash); return ::grpc::Status::OK; |