@@ -10,12 +10,11 @@ USERVER_NAMESPACE_BEGIN
1010
1111namespace server ::handlers {
1212
13- Ping::Ping (const components::ComponentConfig& config, const components::ComponentContext& component_context)
14- : HttpHandlerBase(config, component_context),
15- components_ (component_context),
16- awacs_weight_warmup_time_(config[" warmup-time-secs" ].As<int >(0 )) {}
13+ PingBase::PingBase (const components::ComponentConfig& config, const components::ComponentContext& component_context)
14+ : HttpHandlerBase(config, component_context), components_(component_context) {}
1715
18- std::string Ping::HandleRequestThrow (const http::HttpRequest& request, request::RequestContext& /* context*/ ) const {
16+ std::string PingBase::HandleRequestThrow (const http::HttpRequest& /* request*/ , request::RequestContext& /* context*/ )
17+ const {
1918 if (components_.IsAnyComponentInFatalState ()) {
2019 throw InternalServerError ();
2120 }
@@ -27,6 +26,15 @@ std::string Ping::HandleRequestThrow(const http::HttpRequest& request, request::
2726 throw InternalServerError ();
2827 }
2928
29+ return {};
30+ }
31+
32+ Ping::Ping (const components::ComponentConfig& config, const components::ComponentContext& component_context)
33+ : PingBase(config, component_context), awacs_weight_warmup_time_(config[" warmup-time-secs" ].As<int >(0 )) {}
34+
35+ std::string Ping::HandleRequestThrow (const http::HttpRequest& request, request::RequestContext& context) const {
36+ PingBase::HandleRequestThrow (request, context);
37+
3038 auto & response = request.GetHttpResponse ();
3139 AppendWeightHeaders (response);
3240
@@ -50,7 +58,7 @@ void Ping::AppendWeightHeaders(http::HttpResponse& response) const {
5058}
5159
5260yaml_config::Schema Ping::GetStaticConfigSchema () {
53- return yaml_config::MergeSchemas<HttpHandlerBase >(R"(
61+ return yaml_config::MergeSchemas<PingBase >(R"(
5462type: object
5563description: ping handler config
5664additionalProperties: false
0 commit comments