From fa551556e69adc3866228cc24b9756fa39c6a7ab Mon Sep 17 00:00:00 2001 From: Jose Lago Date: Sat, 4 Jul 2026 11:23:15 +0200 Subject: [PATCH] fix: use async callable for asyncpg pool init instead of string --- worker/src/db.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/worker/src/db.py b/worker/src/db.py index b73ed63..a6fffe4 100644 --- a/worker/src/db.py +++ b/worker/src/db.py @@ -7,6 +7,10 @@ logger = logging.getLogger(__name__) _pool: asyncpg.Pool | None = None +async def _init_connection(conn: asyncpg.Connection) -> None: + await conn.execute("SET search_path TO willhaben_tracker") + + async def get_pool() -> asyncpg.Pool: global _pool if _pool is None: @@ -18,7 +22,7 @@ async def get_pool() -> asyncpg.Pool: database=os.getenv("POSTGRES_DB", "postgres"), min_size=2, max_size=10, - init="SET search_path TO willhaben_tracker" + init=_init_connection ) logger.info("Database pool initialized") return _pool