From: Eyal Halpern Shalev Date: Sat, 4 May 2024 12:57:56 +0000 (+0300) Subject: refactor(pool): replace --ping with empty string X-Git-Tag: 3.2.0~35^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8abaa03f83a5b477cd0e48ed34e89abbe13d1e5;p=thirdparty%2Fpsycopg.git refactor(pool): replace --ping with empty string --- diff --git a/psycopg_pool/psycopg_pool/pool.py b/psycopg_pool/psycopg_pool/pool.py index 96a97ff20..4a086827c 100644 --- a/psycopg_pool/psycopg_pool/pool.py +++ b/psycopg_pool/psycopg_pool/pool.py @@ -537,11 +537,11 @@ class ConnectionPool(Generic[CT], BasePool): for instance as `!check` callback when a pool is created. """ if conn.autocommit: - conn.execute("--ping") + conn.execute("") else: conn.autocommit = True try: - conn.execute("--ping") + conn.execute("") finally: conn.autocommit = False diff --git a/psycopg_pool/psycopg_pool/pool_async.py b/psycopg_pool/psycopg_pool/pool_async.py index 0a6ad529c..ac6925aed 100644 --- a/psycopg_pool/psycopg_pool/pool_async.py +++ b/psycopg_pool/psycopg_pool/pool_async.py @@ -569,7 +569,7 @@ class AsyncConnectionPool(Generic[ACT], BasePool): for instance as `!check` callback when a pool is created. """ if conn.autocommit: - await conn.execute("--ping") + await conn.execute("") else: if True: # ASYNC # NOTE: with Psycopg 3.2 we could use conn.set_autocommit() in @@ -577,13 +577,13 @@ class AsyncConnectionPool(Generic[ACT], BasePool): # previous versions too. await conn.set_autocommit(True) try: - await conn.execute("--ping") + await conn.execute("") finally: await conn.set_autocommit(False) else: conn.autocommit = True try: - conn.execute("--ping") + conn.execute("") finally: conn.autocommit = False