-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add async
-friendly actor HTTPClient
#6022
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
@swift-ci smoke test |
@swift-ci smoke test |
1 similar comment
@swift-ci smoke test |
@@ -28,6 +28,19 @@ public struct URLSessionHTTPClient { | |||
self.downloadTaskManager = DownloadTaskManager(configuration: configuration) | |||
} | |||
|
|||
@available(macOS 12, *) | |||
public func execute( |
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.
couple of things:
- lets add a test that puts some concurrent load on this? there is a similar one already but would be nice to have one that tests the threading across async boundries
- iirc @neonichu ran into some trouble introducing async APIs since some of the CI / toolchain build nodes did not have the backward support libraries. need to make sure that is addressed so we can finally make use of async APIs in SwiftPM
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.
I've added tests that are basically async
ified copies of existing non-async
tests for HTTPClient
. Did you have something specific in mind for testing threading across async boundaries?
@swift-ci smoke test |
f791384
to
8de3549
Compare
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.
👍 assuming CI can handle it :D
@swift-ci smoke test |
Tests/PackageCollectionsTests/JSONPackageCollectionProviderTests.swift
Outdated
Show resolved
Hide resolved
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.
some unrelated changes here need further review / discussion. comments inline
60bde3f
to
f5925b7
Compare
@swift-ci smoke test |
@swift-ci smoke test |
6 similar comments
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci smoke test |
47191c8
to
219ede1
Compare
@swift-ci smoke test |
@swift-ci smoke test |
@swift-ci test Windows platform |
@swift-ci please smoke test Windows platform |
@swift-ci please test Windows platform |
Motivation:
For making HTTP requests in
async
context, eitherHTTPClient
or its replacement need to exposeasync
functions.Modifications:
Existing
HTTPClient
makes strong assumptions about its concurrency behavior, as it exposes Dispatch types in its API. For that reason it was renamed toLegacyHTTPClient
. NewHTTPClient
can use the sameURLSessionHTTPClient
underlying implementation thatLegacyHTTPClient
uses.Additionally, moved
HTTPClientHeaders
,HTTPClientRequest
, andHTTPClientResponse
to separate files for easier maintenance.Depends on #6058 and #6075.
Result:
HTTPClient
can now be used inasync
context. It's not used anywhere in this PR yet, so this is technically NFC.