don't warn if value stayed the same

This commit is contained in:
Daniel Langbein 2024-08-15 17:20:41 +02:00
parent 34a66cd098
commit f93329a67b
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002

View File

@ -102,12 +102,12 @@ class Logger(ABC):
previous_warn_datas = warn_datas[-self.warn_data_range - 1:-1]
prev_num_warnings, prev_highest_warning = self._get_num_warnings(previous_warn_datas)
# Don't send warning again if the current value decreased.
# Don't send warning again if the current value decreased or stayed the same.
if prev_num_warnings >= self.warn_if_above:
previous_warn_data = warn_datas[-2]
if isinstance(current_warn_data, WarnData) \
and isinstance(previous_warn_data, WarnData) \
and current_warn_data.value <= previous_warn_data.value:
and current_warn_data.value < previous_warn_data.value:
return WarnMessage(WarnLevel.NONE)
# Send warning.