Skip to contentSkip to conversation

[2.8][PATCH] asyncrpc: Use client timeout for websocket open timeout

bitbake Steve Sakoman 1 participant 1 message Oct 15, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

From: Joshua Watt <[email protected]>

The default connection timeout for websockets is 10 seconds, so use the provided client timeout instead (which defaults to 30 seconds).

(cherry picked from commit 23681775e5941e54ebead469addf708fca1e6beb)
---
 lib/bb/asyncrpc/client.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
lib/bb/asyncrpc/client.py +5 -1
index a350b4fb1..6fa2839f4 100644
@@ -87,7 +87,11 @@ class AsyncClient(object):
         import websockets
 
         async def connect_sock():
-            websocket = await websockets.connect(uri, ping_interval=None)
+            websocket = await websockets.connect(
+                uri,
+                ping_interval=None,
+                open_timeout=self.timeout,
+            )
             return WebsocketConnection(websocket, self.timeout)
 
         self._connect_sock = connect_sock
Signature · 1 line
2.34.1