Skip to content

Commit 524c9a3

Browse files
committed
refactor: update health to use state
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent bef1fa9 commit 524c9a3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

crates/service/src/routes/health.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
use axum::{
5-
extract::Path,
5+
extract::{Path, State},
66
response::{IntoResponse, Response as AxumResponse},
7-
Extension, Json,
7+
Json,
88
};
99
use graphql_client::GraphQLQuery;
1010
use indexer_config::GraphNodeConfig;
@@ -43,7 +43,7 @@ impl IntoResponse for CheckHealthError {
4343

4444
pub async fn health(
4545
Path(deployment_id): Path<String>,
46-
Extension(graph_node): Extension<GraphNodeConfig>,
46+
State(graph_node): State<GraphNodeConfig>,
4747
) -> Result<impl IntoResponse, CheckHealthError> {
4848
let req_body = HealthQuery::build_query(health_query::Variables {
4949
ids: vec![deployment_id],

crates/service/src/service/indexer_service.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,10 @@ impl IndexerService {
396396

397397
// Check subgraph Health
398398
misc_routes = misc_routes
399-
.route("/subgraph/health/:deployment_id", get(health))
400-
.route_layer(Extension(options.config.graph_node.clone()))
399+
.route(
400+
"/subgraph/health/:deployment_id",
401+
get(health).with_state(options.config.graph_node.clone()),
402+
)
401403
.layer(misc_rate_limiter);
402404

403405
if options.config.service.serve_network_subgraph {

0 commit comments

Comments
 (0)