ferry icon indicating copy to clipboard operation
ferry copied to clipboard

Timeout

Open yasaman93 opened this issue 3 years ago • 3 comments

How can I add time out to the GraphQL requests?

yasaman93 avatar Jun 18 '22 10:06 yasaman93

You can use Dio client as ferry client and set timeout there,

 final dio = Dio(BaseOptions(
        baseUrl: dotenv.env['BASE_URL']!,
        receiveTimeout: 60000,
        connectTimeout: 60000,
        responseType: ResponseType.json,
        headers: <String, dynamic>{
          'Accept': 'application/json',
          'Content-Type': 'application/json',
        },
      ));
return Client(
      link: Link.from([DioLink(dotenv.env['GRAPHQL_ENDPOINT']!, client: dio)]),
    );

ebsangam avatar Jul 21 '22 03:07 ebsangam

@ebsangam What do you think about that adding timeout to request controller layer..? There are different type of transport link (eg. websocket) to handle timeout directly..

dehypnosis avatar Apr 08 '23 12:04 dehypnosis

you can write a TimeoutLink in front of your terminating link which would work regardless of the transport type. RequestControllerTypedLink is the wrong place for that, since is also handles requests for cached content, which for which timeouts do not make sense.

knaeckeKami avatar Apr 08 '23 19:04 knaeckeKami