@@ -55,8 +55,8 @@ async def update_node_connection_status(node_id: int, node: PasarGuardNode):
5555 Update node connection status by getting backend stats and version info.
5656 """
5757 try :
58- await node .get_backend_stats ()
59- node_version , core_version = await node .get_versions ()
58+ await asyncio . wait_for ( node .get_backend_stats (), timeout = 20 )
59+ node_version , core_version = await asyncio . wait_for ( node .get_versions (), timeout = 20 )
6060 async with GetDB () as db :
6161 await NodeOperation ._update_single_node_status (
6262 db ,
@@ -65,6 +65,9 @@ async def update_node_connection_status(node_id: int, node: PasarGuardNode):
6565 xray_version = core_version ,
6666 node_version = node_version ,
6767 )
68+ except asyncio .TimeoutError :
69+ logger .warning (f"Node { node_id } connection status check timed out, will retry on next check" )
70+ return
6871 except NodeAPIError as e :
6972 if e .code > - 3 :
7073 async with GetDB () as db :
@@ -86,8 +89,11 @@ async def process_node_health_check(db_node: Node, node: PasarGuardNode):
8689 return
8790
8891 try :
89- health = await asyncio .wait_for (verify_node_backend_health (node , db_node .name ), timeout = 15 )
92+ health = await asyncio .wait_for (verify_node_backend_health (node , db_node .name ), timeout = 20 )
9093 except asyncio .TimeoutError :
94+ if db_node .status == NodeStatus .connected :
95+ logger .warning (f"Node { db_node .id } ({ db_node .name } ) health check timed out but was previously connected, will retry" )
96+ return
9197 async with GetDB () as db :
9298 await NodeOperation ._update_single_node_status (
9399 db , db_node .id , NodeStatus .error , message = "Health check timeout"
@@ -113,8 +119,8 @@ async def process_node_health_check(db_node: Node, node: PasarGuardNode):
113119 db ,
114120 db_node .id ,
115121 NodeStatus .connected ,
116- xray_version = await core_version ,
117- node_version = await node_version ,
122+ xray_version = core_version ,
123+ node_version = node_version ,
118124 )
119125 return
120126
0 commit comments