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

Add support for nested context manager use #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bardiharborow
Copy link

@bardiharborow bardiharborow commented Jun 28, 2022

This PR adds support for nested use of the UsePrimaryDB context manager. It does this by storing a stack of pinning values locally in the thread and popping each value as the stack unwinds.

This commit adds support for nested use of the UsePrimaryDB context manager. If a new instance of the context manager was created at each level we could use instance variables to store the pinning state but the default instance is generally used directly. Instead, we store a stack of pinning values locally in the thread and pop each value as we unwind the stack.
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.

1 participant