Skip to content

INTPYTHON-574 Use persistent connections by default #285

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions django_mongodb_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ def get_connection_params(self):
settings_dict = self.settings_dict
if not settings_dict["NAME"]:
raise ImproperlyConfigured('settings.DATABASES is missing the "NAME" value.')
# Use persistent connections by default, even if the user specifies
# CONN_MAX_AGE=0. (This code has no way to distinguish that case.)
if settings_dict["CONN_MAX_AGE"] == 0:
settings_dict["CONN_MAX_AGE"] = None
return {
"host": settings_dict["HOST"] or None,
"port": int(settings_dict["PORT"] or 27017),
Expand Down