Hold connection lock in Shelly RPC reconnect (#119009)

This commit is contained in:
Shay Levy 2024-06-07 10:50:05 +03:00 committed by Franck Nijhof
parent cfa619b67e
commit 5bb4e4f5d9
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -584,7 +584,9 @@ class ShellyRpcCoordinator(ShellyCoordinatorBase[RpcDevice]):
raise UpdateFailed(
f"Sleeping device did not update within {self.sleep_period} seconds interval"
)
if self.device.connected:
async with self._connection_lock:
if self.device.connected: # Already connected
return
if not await self._async_device_connect_task():