Skip to content

Commit 0cd1703

Browse files
committed
Alternative idea
1 parent 3dda79b commit 0cd1703

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from asyncio import Task, create_task, sleep
5+
from asyncio import Task, create_task, wait_for
66
from collections.abc import Awaitable, Callable
77
from dataclasses import replace
88
from datetime import UTC, datetime
@@ -473,8 +473,10 @@ async def get_missing_energy_logs(self) -> None:
473473

474474
missing_addresses = sorted(missing_addresses, reverse=True)
475475
for address in missing_addresses:
476-
await self.energy_log_update(address)
477-
await sleep(0.1) # Test with a small delay
476+
try:
477+
await wait_for(self.energy_log_update(address), timeout=5.0)
478+
except TimeoutError:
479+
_LOGGER.error("Failed to update energy log from %s", address)
478480

479481
if self._cache_enabled:
480482
await self._energy_log_records_save_to_cache()

0 commit comments

Comments
 (0)