Skip to content

Commit

Permalink
fix: throttle only /v1/graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Oct 9, 2024
1 parent beb03d9 commit 1a66422
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions crates/fuel-core/src/graphql_api/api_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,21 @@ where
.extension(ViewExtension::new())
.finish();

let unthrottled_routes = Router::new()
.route("/v1/health", get(health))
.route("/health", get(health));

let throttled_routes = Router::new()
let router = Router::new()
.route("/v1/playground", get(graphql_playground))
.route("/v1/graphql", post(graphql_handler).options(ok))
.route(
"/v1/graphql",
post(graphql_handler)
.layer(ConcurrencyLimitLayer::new(concurrency_limit))
.options(ok),
)
.route(
"/v1/graphql-sub",
post(graphql_subscription_handler).options(ok),
)
.route("/v1/metrics", get(metrics))
.layer(ConcurrencyLimitLayer::new(concurrency_limit));

let router = Router::new()
.merge(unthrottled_routes)
.merge(throttled_routes)
.route("/v1/health", get(health))
.route("/health", get(health))
.layer(Extension(schema))
.layer(TraceLayer::new_for_http())
.layer(TimeoutLayer::new(request_timeout))
Expand Down

0 comments on commit 1a66422

Please sign in to comment.