Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to limit the execution time of GraphQL queries #487

Closed
ujibang opened this issue Nov 15, 2023 · 1 comment
Closed

Allow to limit the execution time of GraphQL queries #487

ujibang opened this issue Nov 15, 2023 · 1 comment
Assignees
Milestone

Comments

@ujibang
Copy link
Contributor

ujibang commented Nov 15, 2023

Brief overview

Allow to limit the GraphQL queries execution by setting a time limit.

If a query execution time exceeds the time limit, 408 Request timeout should be returned with following error message:

{
  "errors": [
    {
      "message": "Maximum query time limit of 20ms exceeded",
      "extensions": { "classification": "ExecutionAborted" }
    }
  ]
}

Rationale

Avoid GraphQL queries that consume too much resources.

Detailed documentation

The GraphQL configuration parameter query-time-limit specifies the time limit in milliseconds for processing queries. Set to 0 for no time limit.

Example:

The following command starts RESTHeart overriding the configuration paramenter /graphql/query-time-limit setting a limit of 10s for GraphQL queries execution:

$  RHO="/graphql/query-time-limit->10000" java -jar core/target/restheart.jar
@ujibang ujibang added this to the 7.6 milestone Nov 15, 2023
@ujibang ujibang self-assigned this Nov 15, 2023
@ujibang ujibang changed the title Allow to limit the execution time GraphQL queries Allow to limit the execution time of GraphQL queries Nov 15, 2023
@ujibang
Copy link
Contributor Author

ujibang commented Nov 15, 2023

Done in 7.6.3

@ujibang ujibang closed this as completed Nov 15, 2023
ujibang added a commit that referenced this issue Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant