Skip to content

Commit

Permalink
Check if connection is running before connecting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ilar authored and pschmitt committed May 23, 2024
1 parent 3b9a90d commit 0c0dcbd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions roombapy/roomba.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ def periodic_connection(self) -> None:
# only one connection thread at a time!
if self.periodic_connection_running:
return
self.periodic_connection_running = True
while not self.stop_connection:
try:
self._connect()
if not self.periodic_connection_running:
self._connect()
self.periodic_connection_running = True
except RoombaConnectionError as error:
self.periodic_connection_running = False
self.on_disconnect(MQTT_ERROR_MESSAGES[7])
Expand Down

0 comments on commit 0c0dcbd

Please sign in to comment.