Skip to content

Commit

Permalink
graphql: Log warning about result size before erroring
Browse files Browse the repository at this point in the history
This makes it possible to see in the logs what was rejected by setting both
env variables to the same value
  • Loading branch information
lutter committed Oct 20, 2022
1 parent 34c7c90 commit 90d359c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions graphql/src/store/prefetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,15 +514,15 @@ fn check_result_size<'a>(
ctx: &'a ExecutionContext<impl Resolver>,
size: usize,
) -> Result<(), QueryExecutionError> {
if size > ENV_VARS.graphql.warn_result_size {
warn!(ctx.logger, "Large query result"; "size" => size, "query_id" => &ctx.query.query_id);
}
if size > ENV_VARS.graphql.error_result_size {
return Err(QueryExecutionError::ResultTooBig(
size,
ENV_VARS.graphql.error_result_size,
));
}
if size > ENV_VARS.graphql.warn_result_size {
warn!(ctx.logger, "Large query result"; "size" => size, "query_id" => &ctx.query.query_id);
}
Ok(())
}

Expand Down

0 comments on commit 90d359c

Please sign in to comment.