MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / _after_fork

Method _after_fork

pymongo/synchronous/mongo_client.py:1084–1088  ·  view source on GitHub ↗

Resets topology in a child after successfully forking.

(self)

Source from the content-addressed store, hash-verified

1082 return self._options.load_balanced and not (session and session.in_transaction)
1083
1084 def _after_fork(self) -> None:
1085 """Resets topology in a child after successfully forking."""
1086 self._init_background(self._topology._pid)
1087 # Reset the session pool to avoid duplicate sessions in the child process.
1088 self._topology._session_pool.reset()
1089
1090 def _duplicate(self, **kwargs: Any) -> MongoClient: # type: ignore[type-arg]
1091 args = self._init_kwargs.copy()

Callers 1

_after_fork_childFunction · 0.45

Calls 2

_init_backgroundMethod · 0.95
resetMethod · 0.45

Tested by

no test coverage detected