Skip to content
This repository has been archived by the owner on Sep 24, 2022. It is now read-only.

Commit

Permalink
Fixed ping to handle failures properly.
Browse files Browse the repository at this point in the history
Fixes #115 in the right way.
  • Loading branch information
haizaar committed Aug 26, 2015
1 parent 7c3aefa commit 5e83907
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion momoko/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,10 @@ def on_ping_done(ping_fut):
try:
ping_fut.result()
except psycopg2.Error as error:
ping_future.set_exc_info(error)
if conn.closed:
ping_future.set_exception(self._no_conn_availble_error)
else:
ping_future.set_exc_info(sys.exc_info())
self.putconn(conn)
else:
ping_future.set_result(conn)
Expand Down

0 comments on commit 5e83907

Please sign in to comment.