Skip to content

Commit 90d359c

Browse files
committed
graphql: Log warning about result size before erroring
This makes it possible to see in the logs what was rejected by setting both env variables to the same value
1 parent 34c7c90 commit 90d359c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graphql/src/store/prefetch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,15 @@ fn check_result_size<'a>(
514514
ctx: &'a ExecutionContext<impl Resolver>,
515515
size: usize,
516516
) -> Result<(), QueryExecutionError> {
517+
if size > ENV_VARS.graphql.warn_result_size {
518+
warn!(ctx.logger, "Large query result"; "size" => size, "query_id" => &ctx.query.query_id);
519+
}
517520
if size > ENV_VARS.graphql.error_result_size {
518521
return Err(QueryExecutionError::ResultTooBig(
519522
size,
520523
ENV_VARS.graphql.error_result_size,
521524
));
522525
}
523-
if size > ENV_VARS.graphql.warn_result_size {
524-
warn!(ctx.logger, "Large query result"; "size" => size, "query_id" => &ctx.query.query_id);
525-
}
526526
Ok(())
527527
}
528528

0 commit comments

Comments
 (0)