You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This only fetches GitHub stars, so the payload is not heavy, however if you want to fetch all issues then you have even a bigger problem.
Proposed solution
How will it benefit CLI and its users?
It improves UX as you can cancel executed command, and it will be released immediately instead of being unresponsive for a few seconds.
It reduces the quota consumption, as you won't execute next calls if not needed and also save the bandwidth as you will inform server that the client is not waiting for the response anymore.
Additional context
There are at least two options how it can be achieved:
Add new methods with the WithContext suffix. For example:
// GQLClient is the interface that wraps methods for the different types of// API requests that are supported by the server.typeGQLClientinterface {
// Do executes a GraphQL query request.// The response is populated into the response argument.Do(querystring, variablesmap[string]interface{}, responseinterface{}) error// DoWithContext executes a GraphQL query request.// The response is populated into the response argument.DoWithContext(ctx context.Context, querystring, variablesmap[string]interface{}, responseinterface{}) error
}
Similar approach as Go has for http.Request. It's not a breaking change.
Change all func signature and add the context.Context as a first parameter. It's a breaking change in external API.
There is also an option to add context.Context to struct but it won't work in this case and it's ugly and problematic.
If you agree with one of the provided option, I can create a dedicated PR 👍
The text was updated successfully, but these errors were encountered:
Describe the feature or problem you’d like to solve
Currently, there is no option to cancel the ongoing request.
Here is a small example of pagination request where this would be helpful https://gist.github.com/mszostok/b68ff95f85d4b4ff8a27aeed56f9d3ca.
This only fetches GitHub stars, so the payload is not heavy, however if you want to fetch all issues then you have even a bigger problem.
Proposed solution
How will it benefit CLI and its users?
It improves UX as you can cancel executed command, and it will be released immediately instead of being unresponsive for a few seconds.
It reduces the quota consumption, as you won't execute next calls if not needed and also save the bandwidth as you will inform server that the client is not waiting for the response anymore.
Additional context
There are at least two options how it can be achieved:
Add new methods with the
WithContext
suffix. For example:Similar approach as Go has for http.Request. It's not a breaking change.
Change all func signature and add the
context.Context
as a first parameter. It's a breaking change in external API.There is also an option to add
context.Context
to struct but it won't work in this case and it's ugly and problematic.If you agree with one of the provided option, I can create a dedicated PR 👍
The text was updated successfully, but these errors were encountered: