-
-
Notifications
You must be signed in to change notification settings - Fork 85
Deal with Sendable and clean up package in general #158
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #158 +/- ##
==========================================
- Coverage 82.85% 82.39% -0.46%
==========================================
Files 6 6
Lines 659 659
==========================================
- Hits 546 543 -3
- Misses 113 116 +3
🚀 New features to boost your workflow:
|
…f the SSL helpers
5.10 CI failure is caused by NIO, see apple/swift-nio#3223 |
@@ -547,12 +547,12 @@ final class WebSocketKitTests: XCTestCase { | |||
} | |||
|
|||
func testCreateNewELGAndShutdown() throws { | |||
let client = WebSocketClient(eventLoopGroupProvider: .createNew) | |||
let client = WebSocketClient(eventLoopGroupProvider: .shared(.singletonMultiThreadedEventLoopGroup)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this have a warning or something? because the test name doesn't quite match the change you made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.createNew
is deprecated and I wasn't paying attention to the test name 🤦♀️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One query around sendability
import NIOCore | ||
import NIOHTTP1 | ||
|
||
final class HTTPUpgradeRequestHandler: ChannelInboundHandler, RemovableChannelHandler { | ||
final class HTTPUpgradeRequestHandler: ChannelInboundHandler, RemovableChannelHandler, Sendable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this need to be Sendable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because I didn't think of using NIOLoopBound
first. I'll change it.
let responseEncoder = HTTPResponseEncoder() | ||
let requestDecoder = ByteToMessageHandler(HTTPRequestDecoder(leftOverBytesStrategy: .forwardBytes)) | ||
let proxySimulator = HTTPProxySimulator(promise: promise, config: proxyConfig, expectedAuthorization: expectedAuthorization) | ||
let responseEncoder = NIOLoopBound(HTTPResponseEncoder(), eventLoop: channel.eventLoop) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tests so doesn't matter as much but why the loop bound dance here? We're @unchecked Sendable
and @preconcurrency
importing the types. I would have assumed one of the 3 approaches would be enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because futures are now Strict Concurrency-correct and everything you capture in a closure has to be Sendable
in ways that @preconcurrency
would only silence if you applied it to the entire NIOCore
import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see the tests passing again! That should at least unblock other PRs
These changes are now available in 2.16.0
Covers fixing a bunch of
Sendable
things and does the usual round of package cleanup - bump the Swift minimum to 5.10, update the CI and the README, and so forth. Also fixes up some issues in the tests.