We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 688014f commit fff4117Copy full SHA for fff4117
plugwise_usb/nodes/circle.py
@@ -502,12 +502,13 @@ async def get_missing_energy_logs(self) -> None:
502
create_task(self.energy_log_update(address))
503
for address in missing_addresses
504
]
505
- for task in tasks:
506
- await task
507
- # When an energy log collection task returns False, do not execute the remaining tasks
508
- if not task.result():
509
- for t in tasks:
+ for idx, task in enumerate(tasks):
+ result = await task
+ # When an energy log collection task returns False, stop and cancel the remaining tasks
+ if not result:
+ for t in tasks[idx + 1 :]:
510
t.cancel()
511
+ break
512
513
if self._cache_enabled:
514
await self._energy_log_records_save_to_cache()
0 commit comments