Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort HttpRequests when CancelToken is cancelled #1818

Merged
merged 3 commits into from May 26, 2023

Conversation

kuhnroyal
Copy link
Member

@kuhnroyal kuhnroyal commented May 15, 2023

No longer close the HttpClient but instead abort individual requests. This has the added benefit of fewer HttpClients being constructed. If CancelToken.cancel is called before the request has started, cancel the whole operation.
The HttpClientRequest.abort method was added in Dart 2.10.

New Pull Request Checklist

  • I have read the Documentation
  • I have searched for a similar pull request in the project and found none
  • I have updated this branch with the latest main branch to avoid conflicts (via merge from master or rebase)
  • I have added the required tests to prove the fix/feature I'm adding
  • I have updated the documentation (if necessary)
  • I have run the tests without failures
  • I have updated the CHANGELOG.md in the corresponding package

Additional context and info (if any)

Fixes #1811.

No longer close the HttpClient but instead abort individual requests. This has the added benefit of less HttpClients being constructed.
If `CancelToken.cancel` is called before the request has started, cancel the whole operation.
@kuhnroyal kuhnroyal added p: dio Targeting `dio` package e: performance Improvements or additions to performance labels May 15, 2023
@kuhnroyal kuhnroyal self-assigned this May 15, 2023
@kuhnroyal kuhnroyal requested a review from a team as a code owner May 15, 2023 09:05
@kuhnroyal kuhnroyal merged commit 04a158c into cfug:main May 26, 2023
27 of 31 checks passed
@kuhnroyal kuhnroyal deleted the feature/cancel-token-abort branch May 26, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: performance Improvements or additions to performance p: dio Targeting `dio` package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rework CancelToken handling and HttpClient creation for IOHttpClientAdapter
2 participants