diff options
Diffstat (limited to 'python/skytools/psycopgwrapper.py')
-rw-r--r-- | python/skytools/psycopgwrapper.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python/skytools/psycopgwrapper.py b/python/skytools/psycopgwrapper.py index a005100a..cdb70b69 100644 --- a/python/skytools/psycopgwrapper.py +++ b/python/skytools/psycopgwrapper.py @@ -170,7 +170,8 @@ def connect_database(connstr, keepalive = True, curs = db.cursor() # tune keepalive - set_tcp_keepalive(curs, keepalive, tcp_keepidle, tcp_keepcnt, tcp_keepintvl) + fd = hasattr(db, 'fileno') and db.fileno() or curs.fileno() + set_tcp_keepalive(fd, keepalive, tcp_keepidle, tcp_keepcnt, tcp_keepintvl) # fill .server_version on older psycopg if not hasattr(db, 'server_version'): |