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

Fix TENANT_LIMIT_SET_CALLS implementation #157

Merged
merged 1 commit into from
Jan 11, 2018

Conversation

jgnd
Copy link
Contributor

@jgnd jgnd commented Jan 10, 2018

The change introduced in #115 broke the TENANT_LIMIT_SET_CALLS because the DatabaseWrapper creates a new cursor every time and so the check self._previous_cursor != cursor is never false.
This behaviour is described in PEP 249:

.cursor()
Return a new Cursor Object using the connection.

and can be seen in the underlying implementation (in django.db.backends.base)

I have removed the check and also updated the tests to show the intended behaviour of the TENANT_LIMIT_SET_CALLS setting.

I realise this will probably recreate the issue described in #114 and I tried to figure out the underlying issue but without more information it is hard to diagnose.

@tomturner tomturner merged commit 92b143d into django-tenants:master Jan 11, 2018
@grjones
Copy link

grjones commented Mar 12, 2018

It looks like this is only fixed in Django Tenants 2.0. I think it would be worth backporting this fix to 1.3.x since this is a critical fix, and Django 1.11 will be supported through 2020.

@domdinicola
Copy link
Contributor

@tomturner any plan to release a version (actually 2, for django 1.x and 2.x) with this fix?

@tomturner
Copy link
Member

Sorry I am not releasing any more version 1.x.

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.

4 participants