Skip to content

Commit 969ffcf

Browse files
committed
Clarify connection_ping() vs ping() contract in abstract base class docs
1 parent 2eb0a02 commit 969ffcf

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

web/pgadmin/utils/driver/abstract.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,16 @@ class BaseConnection()
114114
115115
* connected()
116116
- Implement this method to get the status of the connection. It should
117-
return True for connected, otherwise False
117+
return True for connected, otherwise False. This is a local check
118+
only (e.g. inspecting driver-level state) and may not detect
119+
server-side disconnects. Use connection_ping() when a network-level
120+
check is required.
121+
122+
* connection_ping()
123+
- Implement this method to verify the connection is alive by sending a
124+
lightweight query (e.g. SELECT 1) to the server. Returns True if the
125+
server responds, False otherwise. Unlike connected(), this detects
126+
stale or half-open TCP connections that were silently dropped.
118127
119128
* reset()
120129
- Implement this method to reconnect the database server (if possible)

0 commit comments

Comments
 (0)