diff --git a/include/http_data.h b/include/http_data.h index fda4413b..cbebb095 100644 --- a/include/http_data.h +++ b/include/http_data.h @@ -453,6 +453,8 @@ struct http_req { return ip_addr; } + + bool do_resource_check(); }; struct route_path { diff --git a/src/batched_indexer.cpp b/src/batched_indexer.cpp index a206415d..670b1507 100644 --- a/src/batched_indexer.cpp +++ b/src/batched_indexer.cpp @@ -266,8 +266,7 @@ void BatchedIndexer::run() { config.get_disk_used_max_percentage(), config.get_memory_used_max_percentage()); - if (resource_check != cached_resource_stat_t::OK && - orig_req->http_method != "DELETE" && found_rpath->handler != post_health) { + if (resource_check != cached_resource_stat_t::OK && orig_req->do_resource_check()) { const std::string& err_msg = "Rejecting write: running out of resource type: " + std::string(magic_enum::enum_name(resource_check)); LOG(ERROR) << err_msg; diff --git a/src/http_data.cpp b/src/http_data.cpp index 7924b653..25eeb94a 100644 --- a/src/http_data.cpp +++ b/src/http_data.cpp @@ -53,3 +53,7 @@ std::string route_path::_get_action() { return resource_path + ":" + operation; } + +bool http_req::do_resource_check() { + return http_method != "DELETE" && path_without_query != "/health" && path_without_query != "/config"; +}