diff --git a/CHANGELOG.md b/CHANGELOG.md index b4cdc980..7928d7ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- added a way to proccess operations sync (directly send FINISHED) +- added a way to process operations directly (directly send 'Fin' instead of Wait, Started,...) ### Fixed - basic_logging_setup only handles sdc logger, no more side effect due to calling logging.basicConfig. @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The final OperationInvokedReport has OperationTargetRef parameter set. This required refactoring of Operations handling. - moved waveform generator from mdib to roles.waveformprovider +- alert provider performs self check one second before SelfCheckInterval elapses ## [2.0.0a6] - 2023-09-11 diff --git a/src/sdc11073/roles/alarmprovider.py b/src/sdc11073/roles/alarmprovider.py index 2e7f0428..ceaaafe2 100644 --- a/src/sdc11073/roles/alarmprovider.py +++ b/src/sdc11073/roles/alarmprovider.py @@ -32,6 +32,7 @@ class GenericAlarmProvider(providerbase.ProviderRole): """ WORKER_THREAD_INTERVAL = 1.0 # seconds + self_check_safety_margin = 1.0 # how many seconds before SelfCheckInterval elapses a new self check is performed. def __init__(self, mdib: ProviderMdib, log_prefix: str): super().__init__(mdib, log_prefix) @@ -409,10 +410,10 @@ def _get_alert_system_states_needing_update(self) -> list[AbstractStateProtocol] alert_system_state = self._mdib.states.descriptor_handle.get_one(alert_system_descr.Handle, allow_none=True) if alert_system_state is not None: - selfcheck_period = alert_system_descr.SelfCheckPeriod - if selfcheck_period is not None: - last_selfcheck = alert_system_state.LastSelfCheck or 0.0 - if time.time() - last_selfcheck >= selfcheck_period: + self_check_period = alert_system_descr.SelfCheckPeriod + if self_check_period is not None: + last_self_check = alert_system_state.LastSelfCheck or 0.0 + if time.time() - last_self_check >= self_check_period - self.self_check_safety_margin: states_needing_update.append(alert_system_state) except Exception: exc = traceback.format_exc()