]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
doc: give more context to disconnection detection recipe
authorpoulpe <hugouf@hotmail.fr>
Thu, 17 Mar 2022 13:18:46 +0000 (14:18 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 17 Mar 2022 16:26:17 +0000 (17:26 +0100)
docs/advanced/async.rst

index a89273d6ef7f7be5847ce95e4cca66ab43051667..7269bd73add62f00708f57872a5171545f60eb35 100644 (file)
@@ -272,11 +272,11 @@ out of fashion. Besides, it is inefficient (unless what you really want is a
 client-server generator of ones), it generates useless traffic and will only
 detect a disconnection with an average delay of half the polling time.
 
-A more efficient and timely way to detect a server disconnection is to get a
-notification from the OS that the connection has something to say: only then
-you can test the connection. You can dedicate a thread (or an asyncio task) to
-wait on a connection: such thread will perform no activity until awaken by the
-OS.
+A more efficient and timely way to detect a server disconnection is to create
+an additional connection and wait for a notification from the OS that this
+connection has something to say: only then you can run some checks. You
+can dedicate a thread (or an asyncio task) to wait on this connection: such
+thread will perform no activity until awaken by the OS.
 
 In a normal (non asyncio) program you can use the `selectors` module. Because
 the `!Connection` implements a `~Connection.fileno()` method you can just