Skip to content

Add support for asynchronous workflows with ContextVar #18

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

davidbm04
Copy link

This pull request introduces an update to the dynamic-db-router extension by replacing threading.local with ContextVar. This change enhances the extension's ability to handle context better, specifically in asynchronous environments.

Key Changes:

  • Replaced threading.local with ContextVar for maintaining database routing context. This shift allows the router to maintain state across both synchronous threads and asynchronous tasks.
  • Added extra comments to improve readability and allow users to understand what's happening in some of the code paths.

Benefits:

  • Enhanced support for Django’s asynchronous views and tasks, allowing users to utilize the router in a wider range of applications.

We believe these changes will make the dynamic-db-router more versatile.

DavidZheyuYang and others added 4 commits May 7, 2024 03:03

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…s str along with initial else condition that throws an error specifying what the database parameter should be of type. add comments and clean up
feat: add support for async operations
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.

None yet

2 participants