diff mbox series

[scarthgap,2.8] asyncrpc: Use client timeout for websocket open timeout

Message ID 270c0c8bdc802c04fd3021c082d58cf8e8d68d82.1729018312.git.steve@sakoman.com
State New
Headers show
Series [scarthgap,2.8] asyncrpc: Use client timeout for websocket open timeout | expand

Commit Message

Steve Sakoman Oct. 15, 2024, 6:53 p.m. UTC
From: Joshua Watt <JPEWhacker@gmail.com>

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

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 23681775e5941e54ebead469addf708fca1e6beb)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 lib/bb/asyncrpc/client.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/asyncrpc/client.py b/lib/bb/asyncrpc/client.py
index a350b4fb1..6fa2839f4 100644
--- a/lib/bb/asyncrpc/client.py
+++ b/lib/bb/asyncrpc/client.py
@@ -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