Django reversion and multi-tenancy

104 views
Skip to first unread message

vesteinnsna...@gmail.com

unread,
Oct 25, 2019, 9:21:54 AM10/25/19
to django-reversion discussion group
Hi everyone. I'm using a library to support multitenancy (https://github.com/mik3y/django-db-multitenant), i.e. the django application uses different databases based on the incoming subdomain. This seems all to be working fine, but with django-reversion I frequentlty get a hickup when saving a model change that's revisioned. It looks like information from one database is being used to save information in another one, in particular for the content types where a foreign key constraint informs me of the leakage. Both of these libraries use thread local quite heavily which I'm suspecting to be the cause but have not been able to narrow it down. For the multitenancy to work, a custom database backend fetches the database name from the thread before connecting.

Has anyone here had a similar issue come up or any suggestions on what the problem could be?

Vésteinn Snæbjarnarson

unread,
Oct 25, 2019, 1:12:06 PM10/25/19
to django-r...@googlegroups.com
It seems it was the cached property on the models, so luckily nothing to do with the thread locals!

On Fri, 25 Oct 2019 at 13:21, <vesteinnsna...@gmail.com> wrote:
Hi everyone. I'm using a library to support multitenancy (https://github.com/mik3y/django-db-multitenant), i.e. the django application uses different databases based on the incoming subdomain. This seems all to be working fine, but with django-reversion I frequentlty get a hickup when saving a model change that's revisioned. It looks like information from one database is being used to save information in another one, in particular for the content types where a foreign key constraint informs me of the leakage. Both of these libraries use thread local quite heavily which I'm suspecting to be the cause but have not been able to narrow it down. For the multitenancy to work, a custom database backend fetches the database name from the thread before connecting.

Has anyone here had a similar issue come up or any suggestions on what the problem could be?

--
You received this message because you are subscribed to a topic in the Google Groups "django-reversion discussion group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-reversion/y1HRfpjZ6Hg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-reversi...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-reversion/e06ff7a8-8751-4d9b-a87a-680a363c6a07%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages