File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 22import os
33
44from django .core .exceptions import ImproperlyConfigured
5+ from django .db import DEFAULT_DB_ALIAS
56from django .db .backends .base .base import BaseDatabaseWrapper
67from django .db .backends .utils import debug_transaction
78from django .utils .asyncio import async_unsafe
@@ -140,7 +141,10 @@ def _isnull_operator(a, b):
140141 introspection_class = DatabaseIntrospection
141142 ops_class = DatabaseOperations
142143 validation_class = DatabaseValidation
143- session = None
144+
145+ def __init__ (self , settings_dict , alias = DEFAULT_DB_ALIAS ):
146+ super ().__init__ (settings_dict , alias = alias )
147+ self .session = None
144148
145149 def get_collection (self , name , ** kwargs ):
146150 collection = Collection (self .database , name , ** kwargs )
@@ -237,6 +241,9 @@ def close(self):
237241
238242 def close_pool (self ):
239243 """Close the MongoClient."""
244+ # Clear commit hooks and session.
245+ self .run_on_commit = []
246+ self .session = None
240247 connection = self .connection
241248 if connection is None :
242249 return
You can’t perform that action at this time.
0 commit comments