-
Andrey Azeev authored
- Introduce MongoClientManager: owns a shared AsyncMongoClient per process, with idempotent start/close under asyncio.Lock, ping/pool_stats, and crud / sync_crud / long_running_crud factories that inject the client into lightweight CRUD instances. - BaseCrud accepts client= (keyword-only); _owns_client flag drives whether __aenter__/__aexit__ create and close the connection. Legacy connection_string mode unchanged. - Every public CRUD method gains an optional database= kwarg; resolution goes through _resolve_db(database) with fallback to self.db / default_database and a clear LibMongoError otherwise. GridFS cache keyed by (collection, suffix, database). - switch_database now raises in shared-client mode to prevent races on the shared self.db; legacy path retained. - Expose MongoClientManager from package root; bump version to 1.1.0. - New test_singleton.py covers injection, _resolve_db, database= per-call, manager lifecycle/race lock, ping, factories, and long-running client. - README + CHANGELOG document the shared-client pattern and migration.
fb5b5831Andrey Azeev authored- Introduce MongoClientManager: owns a shared AsyncMongoClient per process, with idempotent start/close under asyncio.Lock, ping/pool_stats, and crud / sync_crud / long_running_crud factories that inject the client into lightweight CRUD instances. - BaseCrud accepts client= (keyword-only); _owns_client flag drives whether __aenter__/__aexit__ create and close the connection. Legacy connection_string mode unchanged. - Every public CRUD method gains an optional database= kwarg; resolution goes through _resolve_db(database) with fallback to self.db / default_database and a clear LibMongoError otherwise. GridFS cache keyed by (collection, suffix, database). - switch_database now raises in shared-client mode to prevent races on the shared self.db; legacy path retained. - Expose MongoClientManager from package root; bump version to 1.1.0. - New test_singleton.py covers injection, _resolve_db, database= per-call, manager lifecycle/race lock, ping, factories, and long-running client. - README + CHANGELOG document the shared-client pattern and migration.
To find the state of this project's repository at the time of any of these versions, check out the tags.
Loading