aboutsummaryrefslogtreecommitdiff
path: root/zenserver/compute/function.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver/compute/function.cpp')
-rw-r--r--zenserver/compute/function.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/zenserver/compute/function.cpp b/zenserver/compute/function.cpp
index dd31013ef..171c67a6e 100644
--- a/zenserver/compute/function.cpp
+++ b/zenserver/compute/function.cpp
@@ -39,15 +39,17 @@ HttpFunctionService::HttpFunctionService(CasStore& Store,
{
m_UpstreamApply = UpstreamApply::Create({}, m_CasStore, m_CidStore);
- auto HordeUpstreamEndpoint = UpstreamApplyEndpoint::CreateHordeEndpoint(ComputeOptions,
- ComputeAuthConfig,
- StorageOptions,
- StorageAuthConfig,
- m_CasStore,
- m_CidStore,
- Mgr);
- m_UpstreamApply->RegisterEndpoint(std::move(HordeUpstreamEndpoint));
- m_UpstreamApply->Initialize();
+ InitializeThread = std::thread{[this, ComputeOptions, StorageOptions, ComputeAuthConfig, StorageAuthConfig, &Mgr] {
+ auto HordeUpstreamEndpoint = UpstreamApplyEndpoint::CreateHordeEndpoint(ComputeOptions,
+ ComputeAuthConfig,
+ StorageOptions,
+ StorageAuthConfig,
+ m_CasStore,
+ m_CidStore,
+ Mgr);
+ m_UpstreamApply->RegisterEndpoint(std::move(HordeUpstreamEndpoint));
+ m_UpstreamApply->Initialize();
+ }};
m_Router.AddPattern("job", "([[:digit:]]+)");
m_Router.AddPattern("worker", "([[:xdigit:]]{40})");
@@ -58,8 +60,7 @@ HttpFunctionService::HttpFunctionService(CasStore& Store,
[this](HttpRouterRequest& Req) {
HttpServerRequest& HttpReq = Req.ServerRequest();
- // Todo: check upstream health
- return HttpReq.WriteResponse(HttpResponseCode::OK);
+ return HttpReq.WriteResponse(m_UpstreamApply->IsHealthy() ? HttpResponseCode::OK : HttpResponseCode::ServiceUnavailable);
},
HttpVerb::kGet);