Skip to content

Conversation

@glbrntt
Copy link
Collaborator

Motivation:

The response accumulator is a delegate which must be sendable as it's passed across isolation domains.

Modifications:

  • Make delegates have a sendable requirement
  • Make the response accumulator sendable

Result:

Delegates, and the response accumulator, are sendable

Motivation: The response accumulator is a delegate which must be sendable as it's passed across isolation domains. Modifications: - Make delegates have a sendable requirement - Make the response accumulator sendable Result: Delegates, and the response accumulator, are sendable
@glbrnttglbrntt added the 🆕 semver/minor Adds new public API. label Apr 30, 2025
ifself.requestMethod !=.HEAD,
let contentLength = head.headers.first(name:"Content-Length"),
let announcedBodySize =Int(contentLength),
announcedBodySize >self.maxBodySize
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can I suggest that we pull this computation out of the lock?

/// `EventLoopFuture<Response>` of the execution or cancellation of the execution.
publicfinalclassTask<Response>{
@preconcurrency
publicfinalclassTask<Response:Sendable>{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the unchecked Sendable still needed for this? Can it be checked?

privatevar_isCancelled:Bool=false
privatevar_taskDelegate:HTTPClientTaskDelegate?
privateletlock=NIOLock()
privateletmakeOrGetFileIOThreadPool:()->NIOThreadPool
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this needs an @Sendable.

/// `EventLoopFuture<Response>` of the execution or cancellation of the execution.
publicfinalclassTask<Response>{
@preconcurrency
publicfinalclassTask<Response:Sendable>{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, how sure are we that this constraint is needed?

@glbrnttglbrntt requested a review from LukasaApril 30, 2025 13:07
@LukasaLukasa merged commit 7e6f9cf into swift-server:mainApr 30, 2025
22 of 24 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minorAdds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@glbrntt@Lukasa