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 conformance #110

Closed
wants to merge 11 commits into from
Closed

Add Sendable conformance #110

wants to merge 11 commits into from

Conversation

adam-fowler
Copy link
Member

@adam-fowler adam-fowler commented Oct 30, 2021

Add Sendable conformance to Hummingbird types.
Much of this means setting @unchecked Sendable on types inherited from NIO
There are also a couple of places where I have added @unchecked Sendable on my own types because I don't have a solution yet to ensuring they are Sendable. ie

  • HBEndpointResponder where it needs to be mutable when routes are being added but post that is static. I can write code to get around this.
  • HBRequest.ResponsePatch which is a reference object that is editable from route.

Requiring Sendable is a really good way to find all your possible race conditions

@codecov
Copy link

codecov bot commented Oct 30, 2021

Codecov Report

Merging #110 (c0c9c22) into main (c321935) will decrease coverage by 0.21%.
The diff coverage is 88.46%.

@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
- Coverage   78.13%   77.91%   -0.22%     
==========================================
  Files          72       72              
  Lines        3060     3075      +15     
==========================================
+ Hits         2391     2396       +5     
- Misses        669      679      +10     
Impacted Files Coverage Δ
...Hummingbird/AsyncAwaitSupport/AsyncResponder.swift 0.00% <0.00%> (ø)
...gbird/AsyncAwaitSupport/ConnectionPool+async.swift 0.00% <0.00%> (ø)
...s/Hummingbird/AsyncAwaitSupport/Router+async.swift 0.00% <ø> (ø)
...es/Hummingbird/ConnectionPool/ConnectionPool.swift 91.89% <ø> (ø)
Sources/Hummingbird/Environment.swift 78.37% <ø> (ø)
Sources/Hummingbird/HTTP/URL.swift 83.69% <ø> (ø)
...ources/Hummingbird/Middleware/CORSMiddleware.swift 82.60% <ø> (ø)
.../Hummingbird/Middleware/LogRequestMiddleware.swift 70.58% <ø> (ø)
Sources/Hummingbird/Middleware/Middleware.swift 100.00% <ø> (ø)
Sources/Hummingbird/Router/EndpointResponder.swift 63.63% <ø> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c321935...c0c9c22. Read the comment docs.

Copy link

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Hmmm I guess that looks good. We may keep updating how we adopt Sendable but since your types here are properly just fine it looks good. Confirming that NIO types I guess you'll be able to undo once NIO does so itself - I don't actually know what the game plan here is, will need to think or better yet ask Becca about it - there is a proposal on the forums about adopting Sendable now

@adam-fowler adam-fowler linked an issue Nov 10, 2021 that may be closed by this pull request
@adam-fowler
Copy link
Member Author

too old

@adam-fowler adam-fowler deleted the sendable branch November 23, 2022 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check for Sendable conformance requirements
2 participants