fix: log-and-reraise create_pool failures; lock close() against a racing connect()
connect() built the pool with `await asyncpg.create_pool(...)` outside the try that wraps SELECT-1 validation - with the default min_size=1 the pool connects eagerly, so a bad host/auth propagated with no log.exception line, breaking the documented "every method logs then re-raises" contract. create_pool() now sits inside the same try/log/re-raise as validation, and either failure point tears down a partially-built pool before re-raising. close() didn't take _connect_lock while connect() did, so a close() racing an in-flight connect() would see _pool is None and no-op as success while connect() went on to install a live pool - a shutdown handler racing a reconnect could "close" the instance while real connections stayed open. close() now takes the same lock via a shared _close_locked() helper. Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "psql"
|
||||
version = "0.1.6"
|
||||
version = "0.1.7"
|
||||
description = "async postgres wrapper over asyncpg: two-layer API (friendly verbs + raw escape hatch), fail-loud, config-free"
|
||||
requires-python = ">=3.10"
|
||||
dependencies = [
|
||||
|
||||
Reference in New Issue
Block a user