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

Offer Structured Concurrency conforming APIs for response streaming #728

Open
weissi opened this issue Feb 5, 2025 · 0 comments
Open

Offer Structured Concurrency conforming APIs for response streaming #728

weissi opened this issue Feb 5, 2025 · 0 comments
Labels
good first issue Good for newcomers kind/enhancement Improvements to existing feature. status/needs-design Needs further discussion and a concrete proposal.

Comments

@weissi
Copy link
Member

weissi commented Feb 5, 2025

Motivation

At the moment, the generator generates functions that violate Structured Concurrency for things that use HTTP response streaming. The user gets returned an async sequence that they are then supposed to stream and until that's done resources in other tasks/threads are still holding onto the live request.

This is of course violates the main principle of Structured Concurrency which is that upon return of a function, the execution resources it acquired have been released back.

Violating Structured Concurrency might be acceptable in certain cases but:

  1. It should be documented that what's going on (Document Structured Concurrency violating functions #727)
  2. An alternative should be offered (such as try await withFooRequest(parameters: Parameters) { result, responseBodyStream in ... }) [this feature request]

This feature request part (2), the additional availability of a fully structured API that does response streaming.

Similar efforts in other projects:

Proposed solution

Offer properly structured APIs that support HTTP response streaming in a with* function.

Alternatives considered

No response

Additional information

No response

@weissi weissi added kind/feature New feature. status/triage Collecting information required to triage the issue. labels Feb 5, 2025
@czechboy0 czechboy0 added status/needs-design Needs further discussion and a concrete proposal. kind/enhancement Improvements to existing feature. and removed kind/feature New feature. status/triage Collecting information required to triage the issue. labels Feb 5, 2025
@czechboy0 czechboy0 added the good first issue Good for newcomers label Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/enhancement Improvements to existing feature. status/needs-design Needs further discussion and a concrete proposal.
Projects
None yet
Development

No branches or pull requests

2 participants