PYTHON-4347 Ensure client can be opened after fork() (#1681)

This commit is contained in:
Shane Harvey 2024-06-13 14:35:10 -07:00 committed by GitHub
parent 6f8a22d7d4
commit 48bdbfd278
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View File

@ -896,6 +896,7 @@ class AsyncMongoClient(common.BaseObject, Generic[_DocumentType]):
# this closure. When the client is freed, stop the executor soon.
self_ref: Any = weakref.ref(self, executor.close)
self._kill_cursors_executor = executor
self._opened = False
def _should_pin_cursor(self, session: Optional[ClientSession]) -> Optional[bool]:
return self._options.load_balanced and not (session and session.in_transaction)

View File

@ -895,6 +895,7 @@ class MongoClient(common.BaseObject, Generic[_DocumentType]):
# this closure. When the client is freed, stop the executor soon.
self_ref: Any = weakref.ref(self, executor.close)
self._kill_cursors_executor = executor
self._opened = False
def _should_pin_cursor(self, session: Optional[ClientSession]) -> Optional[bool]:
return self._options.load_balanced and not (session and session.in_transaction)