]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
refactor(pool): replace --ping with empty string
authorEyal Halpern Shalev <eyalsh@gmail.com>
Sat, 4 May 2024 12:57:56 +0000 (15:57 +0300)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Wed, 8 May 2024 16:50:30 +0000 (18:50 +0200)
psycopg_pool/psycopg_pool/pool.py
psycopg_pool/psycopg_pool/pool_async.py

index 96a97ff20583ca87d63e048802231c1e71ddec66..4a086827c0b7959cc8abb72d710be18cc3c343e3 100644 (file)
@@ -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
 
index 0a6ad529cb33cd42dab93929e0471e6ed2035919..ac6925aed76ad95d35eb0740303992f4f4ca4fa4 100644 (file)
@@ -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