Skip to content

Conversation

slafs
Copy link

@slafs slafs commented Jul 9, 2025

Fixes #482

Run sync tasks within copied context.

This is heavily inspired by starlette's run_in_threadpool function
introduced in encode/starlette#192.

Nowadays, starlette is just using anyio.to_thread.run_sync, which does a bunch of extra stuff too,
but from my (limited) understanding,
introducing that would require some changes to the architecture of the project itself 🤔. IDK.

slafs added 2 commits July 9, 2025 17:34
The one for sync fails ATM.
For async is OK.
Run sync tasks within copied context.

This is heavily inspired by starlette's `run_in_threadpool` function
introduced in encode/starlette#192.
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.

Sync tasks loose contextvars
1 participant