Skip to content

Commit

Permalink
RSDK-9610 - reconnect loop should exit if it fails (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuqdog authored Jan 8, 2025
1 parent dd6e7ef commit c69a7d7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/viam/robot/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import sys
from dataclasses import dataclass
from datetime import datetime
from threading import RLock
Expand Down Expand Up @@ -431,6 +432,9 @@ async def _check_connection(self, check_every: int, reconnect_every: int):
self._sessions_client.reset()
self._close_channel()
await asyncio.sleep(reconnect_every)
if not self._connected:
# We failed to reconnect, sys.exit() so that this thread doesn't stick around forever.
sys.exit()

def get_component(self, name: ResourceName) -> ComponentBase:
"""Get a component using its ResourceName.
Expand Down

0 comments on commit c69a7d7

Please sign in to comment.