From da28ed8786df94824d353c375ab08d5c593981b9 Mon Sep 17 00:00:00 2001 From: Varjitt Jeeva Date: Fri, 2 Feb 2024 15:14:00 -0500 Subject: [PATCH] fix: forgot to get postgres conn from pool --- pgbelt/util/pglogical.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pgbelt/util/pglogical.py b/pgbelt/util/pglogical.py index 02bf6cc..95abcdb 100644 --- a/pgbelt/util/pglogical.py +++ b/pgbelt/util/pglogical.py @@ -98,13 +98,14 @@ async def configure_replication_set( Add each table in the given list to the default replication set """ logger.info(f"Creating new replication set 'pgbelt'") - try: - await conn.execute( - "SELECT pglogical.create_replication_set('pgbelt');" - ) - logger.debug(f"{table} added to default replication set") - except Exception as e: - logger.debug(f"Could not create replication set 'pgbelt': {e}") + async with pool.acquire() as conn: + try: + await conn.execute( + "SELECT pglogical.create_replication_set('pgbelt');" + ) + logger.debug(f"{table} added to default replication set") + except Exception as e: + logger.debug(f"Could not create replication set 'pgbelt': {e}") logger.info(f"Configuring default replication set with tables: {tables}") for table in tables: