File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change 33
44from django .core .exceptions import ImproperlyConfigured
55from django .db .backends .base .base import BaseDatabaseWrapper
6+ from django .utils .asyncio import async_unsafe
67from pymongo .collection import Collection
78from pymongo .driver_info import DriverInfo
89from pymongo .mongo_client import MongoClient
@@ -172,6 +173,7 @@ def get_connection_params(self):
172173 ** settings_dict ["OPTIONS" ],
173174 }
174175
176+ @async_unsafe
175177 def get_new_connection (self , conn_params ):
176178 return MongoClient (** conn_params , driver = self ._driver_info ())
177179
@@ -189,11 +191,13 @@ def _rollback(self):
189191 def set_autocommit (self , autocommit , force_begin_transaction_with_broken_autocommit = False ):
190192 pass
191193
194+ @async_unsafe
192195 def close (self ):
193196 super ().close ()
194197 with contextlib .suppress (AttributeError ):
195198 del self .database
196199
200+ @async_unsafe
197201 def cursor (self ):
198202 return Cursor ()
199203
You can’t perform that action at this time.
0 commit comments