aboutsummaryrefslogtreecommitdiff
path: root/zenserver/compute/function.cpp
diff options
context:
space:
mode:
authorJoe Kirchoff <[email protected]>2022-05-03 15:57:02 -0700
committerGitHub <[email protected]>2022-05-03 15:57:02 -0700
commit013e2c7ab88dc51d92d683e8f8ec488bdb4d08d9 (patch)
treea0ca3186204a4f7e7315962de2408082d3d723f3 /zenserver/compute/function.cpp
parentMerge pull request #87 from EpicGames/de/fix-compactcas-threadedinsert-test (diff)
downloadzen-1.0.1.2.tar.xz
zen-1.0.1.2.zip
Initialize upstream apply in background thread (#88)v1.0.1.2
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);