Skip to content

Commit 23c1a44

Browse files
committed
CR: Add small jitter to prevent synchronization bursts
1 parent 5fec0d3 commit 23c1a44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,11 @@ async def _clock_synchronize_scheduler(self) -> None:
860860
"""Background task: periodically synchronize the clock until cancelled."""
861861
try:
862862
while True:
863-
await sleep(CLOCK_SYNC_PERIOD)
863+
await sleep(CLOCK_SYNC_PERIOD + (random.uniform(-5, 5)))
864864
try:
865865
await self.clock_synchronize()
866866
except Exception:
867-
_LOGGER.exception("Clock synchronisation failed for %s", self._mac_in_str)
867+
_LOGGER.exception("Clock synchronization failed for %s", self._mac_in_str)
868868
except CancelledError:
869869
_LOGGER.debug("Clock sync scheduler cancelled for %s", self._mac_in_str)
870870
raise

0 commit comments

Comments
 (0)