fix: async with closes the motor client when connect()/ping fails (mongo-1)

__aenter__ delegated to connect(); when the ping raised on a bad server, __aexit__ was not
called so the eagerly-constructed motor client (with its background topology monitor + pool)
leaked. a retry loop against a flapping DB accumulated live clients. now close-on-failure.
verified: 5 failed async-with blocks leave 0 open clients (was 5). bump v0.1.4 -> v0.1.5

Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
2026-06-30 21:04:51 -04:00
parent e20368287d
commit ebd808f326
3 changed files with 13 additions and 5 deletions
+3 -3
View File
@@ -8,18 +8,18 @@ helpers for the common paths, with a raw escape hatch for everything else.
`requirements.txt`:
```
mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.4
mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.5
```
Direct:
```bash
pip install "mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.4"
pip install "mongo @ git+ssh://git@git.rethinkstudios.io/rethink-public/mongo.git@v0.1.5"
```
Requires `motor` and `pymongo` (pulled transitively).
Drop the `@v0.1.4` suffix from the line above to install the latest unpinned.
Drop the `@v0.1.5` suffix from the line above to install the latest unpinned.
## Usage