File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ struct server_context {
4141struct server_res_generator ;
4242
4343struct server_routes {
44- server_routes (const common_params & params, server_context & ctx_server, server_http_context & ctx_http )
45- : params(params), ctx_server(*ctx_server.impl), ctx_http(ctx_http ) {
44+ server_routes (const common_params & params, server_context & ctx_server, std::function< bool ()> is_ready = []() { return true ; } )
45+ : params(params), ctx_server(*ctx_server.impl), is_ready(is_ready ) {
4646 init_routes ();
4747 }
4848
@@ -79,5 +79,5 @@ struct server_routes {
7979
8080 const common_params & params;
8181 server_context_impl & ctx_server;
82- server_http_context & ctx_http; // for reading is_ready
82+ std::function< bool ()> is_ready;
8383};
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ int main(int argc, char ** argv) {
9999 //
100100
101101 // register API routes
102- server_routes routes (params, ctx_server, ctx_http);
102+ server_routes routes (params, ctx_server, [& ctx_http]() { return ctx_http. is_ready . load (); } );
103103
104104 ctx_http.get (" /health" , ex_wrapper (routes.get_health )); // public endpoint (no API key check)
105105 ctx_http.get (" /v1/health" , ex_wrapper (routes.get_health )); // public endpoint (no API key check)
You can’t perform that action at this time.
0 commit comments