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

Add Sendable conformances to WebsocketKit #131

Merged
merged 25 commits into from
May 24, 2023
Merged

Add Sendable conformances to WebsocketKit #131

merged 25 commits into from
May 24, 2023

Conversation

0xTim
Copy link
Member

@0xTim 0xTim commented Apr 19, 2023

Bump minimum Swift version to 5.6 and add Sendable conformances where appropriate

@0xTim 0xTim added the semver-minor Contains new APIs label Apr 19, 2023
@0xTim 0xTim requested a review from gwynne April 19, 2023 19:08
Package.swift Outdated Show resolved Hide resolved
@0xTim
Copy link
Member Author

0xTim commented Apr 19, 2023

@Lukasa if you want to give this a once over to make sure I'm not doing anything stupid that would be great!

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2023

Codecov Report

Merging #131 (1bedf08) into main (7b6c5bc) will decrease coverage by 1.86%.
The diff coverage is 93.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #131      +/-   ##
==========================================
- Coverage   85.78%   83.93%   -1.86%     
==========================================
  Files           6        6              
  Lines         626      641      +15     
==========================================
+ Hits          537      538       +1     
- Misses         89      103      +14     
Impacted Files Coverage Δ
Sources/WebSocketKit/WebSocket+Connect.swift 98.59% <ø> (ø)
Sources/WebSocketKit/WebSocketHandler.swift 62.50% <ø> (ø)
...bSocketKit/Concurrency/WebSocket+Concurrency.swift 54.16% <75.00%> (-19.37%) ⬇️
Sources/WebSocketKit/WebSocket.swift 88.73% <97.05%> (+0.98%) ⬆️
Sources/WebSocketKit/WebSocketClient.swift 95.34% <100.00%> (+0.05%) ⬆️

Copy link
Member

@gwynne gwynne left a comment

Choose a reason for hiding this comment

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

A few nits. Also fix that horrible lifecycle test in Vapor.

.github/workflows/test.yml Outdated Show resolved Hide resolved
Package.swift Outdated Show resolved Hide resolved
Package.swift Outdated Show resolved Hide resolved
Sources/WebSocketKit/WebSocket.swift Outdated Show resolved Hide resolved
Tests/WebSocketKitTests/SSLTestHelpers.swift Outdated Show resolved Hide resolved
Package.swift Show resolved Hide resolved
gwynne

This comment was marked as outdated.

@gwynne gwynne dismissed their stale review May 19, 2023 06:38

Revision

Copy link
Member

@gwynne gwynne left a comment

Choose a reason for hiding this comment

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

LGTM at this point, with some caveats:

  • With all the @Sendable additions, I wonder if we should require Swift 5.7. Reasoning: NIO wraps such additions in #if swift(>=5.7), despite @preconcurrency having been added in 5.6; I don't know why this is.
  • Definitely wouldn't mind a quick eyeballing of this from @Lukasa.
  • Need to deal with that deadlocking test.

@0xTim
Copy link
Member Author

0xTim commented May 19, 2023

Ok @gwynne I think we're finally good and I've fixed the race conditions in the tests

gwynne
gwynne previously approved these changes May 22, 2023
@0xTim 0xTim merged commit c2e0aa4 into main May 24, 2023
8 checks passed
@0xTim 0xTim deleted the sendable branch May 24, 2023 17:40
@VaporBot
Copy link

These changes are now available in 2.10.0

gwynne added a commit that referenced this pull request May 25, 2023
gwynne added a commit that referenced this pull request May 25, 2023
@gwynne gwynne mentioned this pull request May 25, 2023
0xTim added a commit that referenced this pull request May 25, 2023
0xTim added a commit that referenced this pull request May 25, 2023
* Add dev containers to gitignore

* Revert "Revert "Add Sendable conformances to WebsocketKit (#131)" (#135)"

This reverts commit 0b43ce5.

* Add @preconcurrency annotations to work around unsafe users

* More preconcurrency annotations

* Add API breakage allowlist

* Add missing preconcurrency annotations

* Last missing annotations

* Update allowlist

---------

Co-authored-by: Gwynne Raskind <gwynne@vapor.codes>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor Contains new APIs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants