Skip to content

Replace TransactionBody with NIOAsyncSequenceProducer#677

Merged
Lukasa merged 11 commits into
swift-server:mainfrom
dnadoba:dn-response-body-cancelation
Apr 12, 2023
Merged

Replace TransactionBody with NIOAsyncSequenceProducer#677
Lukasa merged 11 commits into
swift-server:mainfrom
dnadoba:dn-response-body-cancelation

Conversation

@dnadoba

@dnadoba dnadoba commented Apr 5, 2023

Copy link
Copy Markdown
Collaborator

Motivation

We want to properly respect task cancelation during the call to HTTPClientResponse.Body.AsyncIterator.next().

Modification

Replace our custom AsyncSequence implementation by delegate most of the work to NIOAsyncSequenceProducer from NIOCore

Result

We fully support cancelation throughout the stack and get the performance benefits of NIOAsyncSequenceProducer.

dnadoba added 6 commits March 31, 2023 16:44
Conflicts:
	Sources/AsyncHTTPClient/AsyncAwait/HTTPClientResponse.swift
	Sources/AsyncHTTPClient/AsyncAwait/Transaction.swift
	Sources/AsyncHTTPClient/AsyncAwait/TransactionBody.swift
which currently fails because of apple/swift-nio#2398
@dnadoba dnadoba added the 🆕 semver/minor Adds new public API. label Apr 5, 2023
@dnadoba

dnadoba commented Apr 12, 2023

Copy link
Copy Markdown
Collaborator Author

We now also throw CancellationError instead of HTTPClientError.cancelled if the task is cancelled while awaiting the response head.

@glbrntt glbrntt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good but I'm not super familiar with AHC.

@Lukasa
Lukasa merged commit e18db27 into swift-server:main Apr 12, 2023
@dnadoba
dnadoba deleted the dn-response-body-cancelation branch April 12, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants