Skip to content

feat(gql_dio_link): support per-request timeouts via DioLinkTimeoutCo… - #522

Open
ljanecek wants to merge 1 commit into
gql-dart:masterfrom
ljanecek:feat/dio-link-request-options
Open

feat(gql_dio_link): support per-request timeouts via DioLinkTimeoutCo…#522
ljanecek wants to merge 1 commit into
gql-dart:masterfrom
ljanecek:feat/dio-link-request-options

Conversation

@ljanecek

Copy link
Copy Markdown

Why

DioLink reads only DioLinkCancelTokenContextEntry and HttpLinkHeaders
from the request context — there is no way to set Dio's
sendTimeout/receiveTimeout for a single operation. Long-running
operations (e.g. a mutation waiting ~20 s for a device to acknowledge a
command) then require a second Dio/GraphQLClient instance, or smuggling a
marker header through HttpLinkHeaders and converting it in an interceptor.

What

Adds DioLinkTimeoutContextEntry({sendTimeout, receiveTimeout}), following
the same pattern as DioLinkCancelTokenContextEntry. null fields keep the
client-wide timeouts. Deliberately limited to timeouts (instead of a whole
dio.Options) so the link keeps control of responseType and headers —
happy to generalize if you'd prefer.

client.mutate(MutationOptions(
  document: ...,
  context: const Context().withEntry(
    const DioLinkTimeoutContextEntry(receiveTimeout: Duration(seconds: 20)),
  ),
));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant