public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PATCH: To fix the issue of highlighting error in the query tool (pgAdmin4)
Date: Fri, 9 Sep 2016 18:06:48 +0530
Message-ID: <CAKKotZTgd4OH_K89F1j81xXzdz=waAthzfT2+g-w-x1hSLWTSw@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
PFA patch for highlighting error in the query tool which was broken due to
commit: d6391c7e9b26e5e10bb3
RM#1676
*Issue: *
We removed timeout in poll function due to which we were not able fetch
error properly.
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] RM_1676.patch (2.0K, 3-RM_1676.patch)
download | inline diff:
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py
index d4465ea..95aa95c 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -1044,9 +1044,31 @@ Failed to reset the connection to the server due to following error:
if state == psycopg2.extensions.POLL_OK:
return self.ASYNC_OK
elif state == psycopg2.extensions.POLL_WRITE:
- return self.ASYNC_WRITE_TIMEOUT
+ # Wait for the given time and then check the return status
+ # If three empty lists are returned then the time-out is reached.
+ timeout_status = select.select([], [conn.fileno()], [], time)
+ if timeout_status == ([], [], []):
+ return self.ASYNC_WRITE_TIMEOUT
+
+ # poll again to check the state if it is still POLL_WRITE
+ # then return ASYNC_WRITE_TIMEOUT else return ASYNC_OK.
+ state = conn.poll()
+ if state == psycopg2.extensions.POLL_WRITE:
+ return self.ASYNC_WRITE_TIMEOUT
+ return self.ASYNC_OK
elif state == psycopg2.extensions.POLL_READ:
- return self.ASYNC_READ_TIMEOUT
+ # Wait for the given time and then check the return status
+ # If three empty lists are returned then the time-out is reached.
+ timeout_status = select.select([conn.fileno()], [], [], time)
+ if timeout_status == ([], [], []):
+ return self.ASYNC_READ_TIMEOUT
+
+ # poll again to check the state if it is still POLL_READ
+ # then return ASYNC_READ_TIMEOUT else return ASYNC_OK.
+ state = conn.poll()
+ if state == psycopg2.extensions.POLL_READ:
+ return self.ASYNC_READ_TIMEOUT
+ return self.ASYNC_OK
else:
raise psycopg2.OperationalError(
"poll() returned %s from _wait_timeout function" % state
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: PATCH: To fix the issue of highlighting error in the query tool (pgAdmin4)
In-Reply-To: <CAKKotZTgd4OH_K89F1j81xXzdz=waAthzfT2+g-w-x1hSLWTSw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox