diff options
| -rw-r--r-- | src/zenserver/projectstore/buildsremoteprojectstore.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/zenserver/projectstore/buildsremoteprojectstore.cpp b/src/zenserver/projectstore/buildsremoteprojectstore.cpp index c9a01e56a..52cdc5983 100644 --- a/src/zenserver/projectstore/buildsremoteprojectstore.cpp +++ b/src/zenserver/projectstore/buildsremoteprojectstore.cpp @@ -270,6 +270,37 @@ public: m_OplogBuildPartId, Ex.what()); } + + if (!Result.ErrorCode && Result.Needs.empty()) + { + try + { + m_BuildStorage->FinalizeBuild(m_BuildId); + } + catch (const HttpClientError& Ex) + { + Result.ErrorCode = Ex.m_Error != 0 ? Ex.m_Error + : Ex.m_ResponseCode != HttpResponseCode::ImATeapot ? (int)Ex.m_ResponseCode + : 0; + Result.Reason = fmt::format("Failed finalizing oplog container build to {}/{}/{}/{}. Reason: '{}'", + m_Url, + m_Namespace, + m_Bucket, + m_BuildId, + Ex.what()); + } + catch (const std::exception& Ex) + { + Result.ErrorCode = gsl::narrow<int32_t>(HttpResponseCode::InternalServerError); + Result.Reason = fmt::format("Failed finalizing oplog container build to {}/{}/{}/{}. Reason: '{}'", + m_Url, + m_Namespace, + m_Bucket, + m_BuildId, + Ex.what()); + } + } + return Result; } |