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

Router that ensures the same DB is used within a request #29

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

Conversation

gnarvaja
Copy link

Uses thread local storage (o gevent local storage if available) to store the current DB in use. In the first call for a request, it sets the current db in use and returns always the same.

At the start of each request, the middleware cleans the current DB.

@jsocol
Copy link
Collaborator

jsocol commented Jan 8, 2019

Super late to this, but I think this has two great ideas in it:

  1. supporting gevent greenlet locals
  2. stick to the same DB (which I think would fix ValueError: Can't do subqueries with queries on different DBs. #20)

I want to break these apart because I think there's some nuance to (1) (e.g. just because gevent is installed doesn't mean it's in use) and for (2) I don't think we need a different router—I think it's arguably correct behavior. So I think we can address these separately and move them both forward.

@jsocol
Copy link
Collaborator

jsocol commented Jan 8, 2019

(Actually, re-reading some old issues/code, I feel like Gevent patches threading.local by default? I'd rather confirm that there's an issue before writing code to fix it.)

@jsocol jsocol added this to the 1.0 milestone Jan 21, 2019
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