Merge pull request #9380 from tchak/graphql-timeout

ETQ Intégrateur API, je voudrai que le timeout de l'API soit plus long
This commit is contained in:
Paul Chavard 2023-08-02 11:30:55 +00:00 committed by GitHub
commit 0bed8bd1e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View file

@ -59,6 +59,7 @@ class API::V2::Context < GraphQL::Query::Context
{
graphql_query: query.query_string,
graphql_variables: query.provided_variables&.to_json,
graphql_mutation: mutation?,
graphql_null_error: errors.any? { _1.is_a? GraphQL::InvalidNullError }.presence,
graphql_timeout_error: errors.any? { _1.is_a? GraphQL::Schema::Timeout::TimeoutError }.presence
}.compact
@ -66,6 +67,12 @@ class API::V2::Context < GraphQL::Query::Context
private
def mutation?
query.lookahead.selections.any? { _1.field.type.respond_to?(:mutation) }.presence
rescue
false
end
def compute_demarche_authorization(demarche)
# procedure_ids and token are passed from graphql controller
if self[:procedure_ids].present?

View file

@ -138,7 +138,7 @@ class API::V2::Schema < GraphQL::Schema
end
end
use Timeout, max_seconds: 10
use Timeout, max_seconds: 30
use GraphQL::Batch
use GraphQL::Backtrace

View file

@ -18,6 +18,7 @@ Rails.application.configure do
graphql_variables: event.payload[:graphql_variables],
graphql_null_error: event.payload[:graphql_null_error],
graphql_timeout_error: event.payload[:graphql_timeout_error],
graphql_mutation: event.payload[:graphql_mutation],
ds_procedure_id: event.payload[:ds_procedure_id],
ds_dossier_id: event.payload[:ds_dossier_id],
browser: event.payload[:browser],