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

Feature request: expose context contents to workers in other threads #6

Open
jsbueno opened this issue Sep 26, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@jsbueno
Copy link
Owner

jsbueno commented Sep 26, 2024

Currently, contextvars -either stdlib's, or the objects in this project, offer a nice way to have each async task able to share contextual information (for example, information about an HTTP request) -

However, when doing asyncio programming a common pattern is to have some otherwise synchronous call to be executed in a thread-pool worker (for example, through an asyncio.loop.run_in_executor call).

The synch function called in this way is essentialy part of the task calling .run_in_executor - but there is no straightforward way to make the context variables in the main (async-) thread visible in the worker in the other threads. (any other thread starts with an empty context by default).

This is a natural fill-in for extra-context!

@jsbueno jsbueno added the enhancement New feature or request label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant