From fe26565164886f38613fa5c33fe2071f30603f8d Mon Sep 17 00:00:00 2001 From: Maxim Pertsov Date: Wed, 20 Sep 2023 13:35:26 -0400 Subject: [PATCH] check connection status before attempting to reconnect --- src/viam/robot/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/viam/robot/client.py b/src/viam/robot/client.py index 784899c65..b91ddf83c 100644 --- a/src/viam/robot/client.py +++ b/src/viam/robot/client.py @@ -285,6 +285,9 @@ async def _check_connection(self, check_every: int, reconnect_every: int): if reconnect_every <= 0: continue + if self._connected: + continue + reconnect_attempts = self._options.dial_options.max_reconnect_attempts if self._options.dial_options else 3 for _ in range(reconnect_attempts):