Skip to content

Commit

Permalink
Add a recommendation to verify the usability of the connection
Browse files Browse the repository at this point in the history
  • Loading branch information
larskanis committed Apr 20, 2023
1 parent ce8b2cf commit cf1a2e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/pg/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ def ssl_attributes
# Only pending data is read from the socket - the method doesn't wait for any outstanding server answers.
#
# Raises a kind of PG::Error if there was an error reading the data or if the socket is in a failure state.
#
# The method doesn't verify that the server is still responding.
# To verify that the communication to the server works, it is recommended to use something like <tt>conn.exec('')</tt> instead.
def check_connection
while socket_io.wait_readable(0)
consume_input
Expand Down

0 comments on commit cf1a2e2

Please sign in to comment.