Skip to content

refactor stream_with_context for async views#5799

Merged
davidism merged 1 commit intostablefrom
stream-context
Aug 19, 2025
Merged

refactor stream_with_context for async views#5799
davidism merged 1 commit intostablefrom
stream-context

Conversation

@davidism
Copy link
Copy Markdown
Member

Store the app context as well as the request context when creating the generator. This prevents the request context from automatically creating and pushing a different app context. Then push the app context first, and push them only when iteration starts, not during setup. This prevents the request context from automatically popping the app context, and avoids associating the internal ContextVar with the temporary event loop in async views.

fixes #5774

@davidism davidism added this to the 3.1.2 milestone Aug 19, 2025
@davidism davidism added the async label Aug 19, 2025
@davidism davidism merged commit 38b4c1e into stable Aug 19, 2025
13 checks passed
@davidism davidism deleted the stream-context branch August 19, 2025 15:23
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant