Skip to content

fix copy_context in ws threadpool#3862

Merged
T4rk1n merged 4 commits into
devfrom
fix/ws-contextvars
Jul 3, 2026
Merged

fix copy_context in ws threadpool#3862
T4rk1n merged 4 commits into
devfrom
fix/ws-contextvars

Conversation

@T4rk1n

@T4rk1n T4rk1n commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #3861
Move copy_context before submit in order to capture loop context.

T4rk1n and others added 2 commits July 2, 2026 10:33
…ng loop)

Construct the janus.Queue inside asyncio.run so it has a running event loop
on Python < 3.10, where janus.Queue.__init__ calls get_running_loop().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@camdecoster camdecoster self-assigned this Jul 2, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@T4rk1n T4rk1n merged commit 9ba8421 into dev Jul 3, 2026
29 of 30 checks passed
@T4rk1n T4rk1n deleted the fix/ws-contextvars branch July 3, 2026 14:36
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.

websocket=True callbacks don't see ContextVars set by ASGI middleware (copy_context() called on the wrong thread in run_callback_in_executor)

2 participants