-
Notifications
You must be signed in to change notification settings - Fork 430
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
perf: respect django database routing #451
base: main
Are you sure you want to change the base?
perf: respect django database routing #451
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also add relevant test ?
ab8f2d9
to
e718a8b
Compare
Sorry, I'm trying to add unit tests for here but don't have any good ideas. I referenced Django's unit tests and used the override_settings decorator to simulate the multidb case. By default, the Router's db_for_write method returning None will cause Django to use the default database configuration, regardless of whether the user is using multidb or not. |
using django unit test is a good start, I will take some time to properly review & test it before merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are failing. also please rebase
Summary:
The problem you want to solve
If the django project is configured with multiple databases, the default behavior in the django-celery-beat will cause django to get the default database connection, but at this time it is an empty dictionary, and then a database configuration exception will be thrown. This pr will check the DATABASE_ROUTERS to determine whether django db router is needed.