Skip to content

Commit a5d8a30

Browse files
committed
Use persistent connections by default
1 parent 4b48571 commit a5d8a30

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

django_mongodb_backend/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ def get_connection_params(self):
165165
settings_dict = self.settings_dict
166166
if not settings_dict["NAME"]:
167167
raise ImproperlyConfigured('settings.DATABASES is missing the "NAME" value.')
168+
# Use persistent connections by default, even if the user specifies
169+
# CONN_MAX_AGE=0. (This code has no way to distinguish that case.)
170+
if settings_dict["CONN_MAX_AGE"] == 0:
171+
settings_dict["CONN_MAX_AGE"] = None
168172
return {
169173
"host": settings_dict["HOST"] or None,
170174
"port": int(settings_dict["PORT"] or 27017),

0 commit comments

Comments
 (0)