From d52aafd7f6fe0115ba2fd3a7e794a778291f65fe Mon Sep 17 00:00:00 2001 From: atse Date: Mon, 31 Jul 2023 00:34:09 +0800 Subject: [PATCH] Add timeout to connect call --- pytec/pytec/aioclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytec/pytec/aioclient.py b/pytec/pytec/aioclient.py index d07ebce..0095c69 100644 --- a/pytec/pytec/aioclient.py +++ b/pytec/pytec/aioclient.py @@ -23,7 +23,7 @@ class Client: if connected: return """ - self._connecting_task = asyncio.create_task(asyncio.open_connection(host, port)) + self._connecting_task = asyncio.create_task(asyncio.wait_for(asyncio.open_connection(host, port), timeout)) try: self._reader, self._writer = await self._connecting_task except asyncio.CancelledError: