ferry
ferry copied to clipboard
Timeout
How can I add time out to the GraphQL requests?
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 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..
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.