File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ class ProxyConfig:
6464
6565
6666class TargetKeepAliveSender :
67+ _log : logging .Logger = logging .getLogger (__name__ )
68+
6769 _target_url : str
6870 _keep_alive_min_interval : int
6971 _loop : asyncio .AbstractEventLoop
@@ -86,8 +88,15 @@ async def _send_worker(self) -> None:
8688 while True :
8789 await self ._queue .get ()
8890
89- async with aiohttp .request ("GET" , self ._target_url ) as resp :
90- await resp .json ()
91+ try :
92+ async with aiohttp .request (
93+ "GET" ,
94+ self ._target_url ,
95+ timeout = aiohttp .ClientTimeout (total = 5 ),
96+ ) as resp :
97+ await resp .json ()
98+ except (aiohttp .ClientError , aiohttp .ClientResponseError ):
99+ self ._log .warning ("Failed to send target keep alive request to %s" , self ._target_url , exc_info = True )
91100
92101 await asyncio .sleep (self ._keep_alive_min_interval )
93102
You can’t perform that action at this time.
0 commit comments