fix: close() nulls pool + connect() lock guards against concurrent races (psql-7, psql-8)
- close() sets self._pool = None (in a finally, even on driver-error close) so a closed instance reports not-connected instead of masquerading as still-connected against a dead pool (the pool property now raises RuntimeError post-close as intended). - connect() is now guarded by an internal asyncio.Lock: concurrent connect() calls serialize instead of each racing to build + orphan its own live pool. Twin fix with mysql at the same Layer-1 signature level. - docstrings tightened (module header lifecycle/dsn notes, __init__ dsn note) with zero behavior change; re-verified against a real embedded postgres. verified against pixeltable-pgserver (test-only): 8 concurrent connect() calls now leave 0 orphaned pools + exactly 1 live pool (old: 7 orphaned, 8 live simultaneously); close() now flips the connected-check to False (old: stayed True against a dead pool). full layer-1/layer-2/transaction/concurrency regression suite still green. fresh-venv install confirms runtime purity (asyncpg only, no pixeltable-pgserver). bump v0.1.4 -> v0.1.5 Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -10,18 +10,18 @@ a sibling of the `mongo` lib. Class is **`PsqlDB`**.
|
||||
`requirements.txt`:
|
||||
|
||||
```
|
||||
psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.4
|
||||
psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.5
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.4"
|
||||
pip install "psql @ git+ssh://git@git.rethinkstudios.io/rethink-public/psql.git@v0.1.5"
|
||||
```
|
||||
|
||||
Pulls `asyncpg`.
|
||||
|
||||
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.
|
||||
|
||||
## The two-layer API
|
||||
|
||||
|
||||
Reference in New Issue
Block a user