@@ -710,7 +710,7 @@ async def subscribe_attribute(
710
710
)
711
711
712
712
@api_command (APICommand .PING_NODE )
713
- async def ping_node (self , node_id : int ) -> NodePingResult :
713
+ async def ping_node (self , node_id : int , attempts : int = 1 ) -> NodePingResult :
714
714
"""Ping node on the currently known IP-adress(es)."""
715
715
result : NodePingResult = {}
716
716
node = self ._nodes .get (node_id )
@@ -741,7 +741,7 @@ async def _do_ping(ip_address: str) -> None:
741
741
else :
742
742
clean_ip = ip_address
743
743
node_logger .debug ("Pinging address %s" , clean_ip )
744
- result [clean_ip ] = await ping_ip (ip_address , timeout )
744
+ result [clean_ip ] = await ping_ip (ip_address , timeout , attempts = attempts )
745
745
746
746
ip_addresses = await self .get_node_ip_addresses (
747
747
node_id , prefer_cache = False , scoped = True
@@ -1058,7 +1058,7 @@ async def _setup_node(self, node_id: int) -> None:
1058
1058
# Ping the node to rule out stale mdns reports and to prevent that we
1059
1059
# send an unreachable node to the sdk which is very slow with resolving it.
1060
1060
# This will also precache the ip addresses of the node for later use.
1061
- ping_result = await self .ping_node (node_id )
1061
+ ping_result = await self .ping_node (node_id , attempts = 3 )
1062
1062
if not any (ping_result .values ()):
1063
1063
LOGGER .warning (
1064
1064
"Skip set-up for node %s because it does not appear to be reachable..." ,
0 commit comments