Skip to content

Commit

Permalink
add check if config option max_retries is not set, to avoid unlimited…
Browse files Browse the repository at this point in the history
… loops
  • Loading branch information
RubenKelevra committed Dec 24, 2024
1 parent f94bbc5 commit 158d8bc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/measure/measure/util/measure_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ def take_measurement(
retry_count: int = 0,
) -> float:
"""Get a measurement from the powermeter, take multiple samples and calculate the average"""

if self.config.max_retries is None:
_LOGGER.error("No max_retries value was configured. Aborting to prevent infinite loop.")

measurements = []
# Take multiple samples to reduce noise
for i in range(1, self.config.sample_count + 1):
Expand Down

0 comments on commit 158d8bc

Please sign in to comment.