diff options
Diffstat (limited to 'src/buildtool/execution_api/execution_service')
-rw-r--r-- | src/buildtool/execution_api/execution_service/bytestream_server.cpp | 2 | ||||
-rw-r--r-- | src/buildtool/execution_api/execution_service/execution_server.cpp | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/buildtool/execution_api/execution_service/bytestream_server.cpp b/src/buildtool/execution_api/execution_service/bytestream_server.cpp index 1740c1f1..7d2bd48a 100644 --- a/src/buildtool/execution_api/execution_service/bytestream_server.cpp +++ b/src/buildtool/execution_api/execution_service/bytestream_server.cpp @@ -138,7 +138,7 @@ auto BytestreamServiceImpl::Write( auto tmp = tmp_dir->GetPath() / write_digest->hash(); { std::ofstream stream{tmp, std::ios::binary}; - do { + do { // NOLINT(cppcoreguidelines-avoid-do-while) if (not stream.good()) { auto const str = fmt::format("Failed to write data for {}", write_digest->hash()); 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; |