Detecting disconnection documentation #800
Unanswered
jnunnerley
asked this question in
Q&A
Replies: 1 comment
-
What is referred in this recipe is how to detect a disconnection from the server, not the closure of a single connection. If a connection is in use there will be any sort of activity on that FD. The idea is to use a connection not otherwise used. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
https://www.psycopg.org/psycopg3/docs/advanced/async.html#detecting-disconnections
Says an additional connection is required, could this be elaborated on please.
It's not clear to me what triggers the OS read change notification, it doesn't seem to be the case of data available to read on the socket. For example I can have a main thread making repeated queries and then a second thread using the same connection waiting on the OS for the disconnect checking. In this case in never gets triggered until the socket is disconnected. Based on this simple test, I can actually use the same connection but I'm sure I'm missing something.
Beta Was this translation helpful? Give feedback.
All reactions