Fix an issue that could cause the Query Tool to fail to render. Fixes #3433

This commit is contained in:
Khushboo Vashi
2018-12-13 11:15:55 +00:00
committed by Dave Page
parent dfbb2212c0
commit e666b0fab0
3 changed files with 6 additions and 2 deletions

View File

@@ -169,6 +169,7 @@ class BaseConnection(object):
ASYNC_NOT_CONNECTED = 4
ASYNC_EXECUTION_ABORTED = 5
ASYNC_TIMEOUT = 0.2
ASYNC_WAIT_TIMEOUT = 2
ASYNC_NOTICE_MAXLENGTH = 100000
@abstractmethod

View File

@@ -1335,9 +1335,11 @@ Failed to reset the connection to the server due to following error:
if state == psycopg2.extensions.POLL_OK:
break
elif state == psycopg2.extensions.POLL_WRITE:
select.select([], [conn.fileno()], [])
select.select([], [conn.fileno()], [],
self.ASYNC_WAIT_TIMEOUT)
elif state == psycopg2.extensions.POLL_READ:
select.select([conn.fileno()], [], [])
select.select([conn.fileno()], [], [],
self.ASYNC_WAIT_TIMEOUT)
else:
raise psycopg2.OperationalError(
"poll() returned %s from _wait function" % state)