From 6b1be4a3d5ed35fcfc594c2311357dc5ebbb0c7b Mon Sep 17 00:00:00 2001 From: Robsdedude Date: Thu, 27 Oct 2022 09:23:37 +0200 Subject: [PATCH] Correctly rewrite socket timeouts on sending --- neo4j/_async/io/_common.py | 4 +++- neo4j/_sync/io/_common.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/neo4j/_async/io/_common.py b/neo4j/_async/io/_common.py index 8f510689a..2f7c18266 100644 --- a/neo4j/_async/io/_common.py +++ b/neo4j/_async/io/_common.py @@ -139,7 +139,9 @@ async def flush(self): if data: try: await self.socket.sendall(data) - except (OSError, asyncio.CancelledError) as error: + except ( + OSError, SocketDeadlineExceeded, asyncio.CancelledError + ) as error: await AsyncUtil.callback(self.on_error, error) return False self._clear() diff --git a/neo4j/_sync/io/_common.py b/neo4j/_sync/io/_common.py index 3aa2f24d9..04312bfe4 100644 --- a/neo4j/_sync/io/_common.py +++ b/neo4j/_sync/io/_common.py @@ -139,7 +139,9 @@ def flush(self): if data: try: self.socket.sendall(data) - except (OSError, asyncio.CancelledError) as error: + except ( + OSError, SocketDeadlineExceeded, asyncio.CancelledError + ) as error: Util.callback(self.on_error, error) return False self._clear()