-
Notifications
You must be signed in to change notification settings - Fork 123
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
offer Structured Concurrency API that supports HTTP response streaming #807
Comments
I think we need slightly more since request can also be streamed and swift
|
Possibly, but currently we do need an
Don't need any |
Yes if we just wrap the current AHC APIs than this is enough. In general this API should always be legal it is just a convenience on top of the bi-di streaming API with a writer. |
Gotcha, yes. So I think there are (at least) two parts to this:
I was thinking (1) for this ticket and you added (2). That's fine, I'm happy with this, just to check we're on the same page. |
At the moment, `HTTPClient`'s entire API surface violates Structured Concurrency. Both the creation & shutdown of a HTTP client as well as making requests (#807) doesn't follow Structured Concurrency. Some of the problems are: 1. Upon return of methods, resources are still in active use in other threads/tasks 2. Cancellation doesn't always work This PR is baby steps towards a Structured Concurrency API, starting with start/shutdown of the HTTP client. Co-authored-by: Johannes Weiss <[email protected]>
Currently, most of
HTTPClient
's API surface only supports Structured Concurrency violating functions. Baby steps to rectify this have been done in #806. But the elephant in the room is of course the unstructured HTTP request API.We need to also provide a
API that fulfils Structured Concurrency by supporting cancellation and tearing everything down when the
body
function returns orthrows
without ineffective and ugly hacks likedeinit
(which still violates Structured Concurrency because it doesn't follow the structure of the code).The text was updated successfully, but these errors were encountered: