From 6272757322636ae0dff0f87e082244d91a26809e Mon Sep 17 00:00:00 2001 From: Anna Waldron Date: Tue, 20 Nov 2018 16:29:47 -0800 Subject: [PATCH] Issue #92 - Update limit monitoring with checks for lowering repeat notifications Implements new limit trip notification 'frequency' config by triggering notifications every 'frequency' consecutive limit-tripping packet, not taking 'threshold' into account. --- ait/gui/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ait/gui/__init__.py b/ait/gui/__init__.py index 20225d81..42ffa94c 100644 --- a/ait/gui/__init__.py +++ b/ait/gui/__init__.py @@ -390,6 +390,7 @@ def telem_handler(session): packet_dict[v.uid] = v notif_thrshld = cfg.AitConfig.get('notifications.options.threshold') + notif_freq = cfg.AitConfig.get('notifications.options.frequency') log.info('Starting telemetry limit monitoring') try: @@ -416,7 +417,8 @@ def telem_handler(session): limit_trip_repeats[packet.name][field] += 1 - if limit_trip_repeats[packet.name][field] == notif_thrshld: + if limit_trip_repeats[packet.name][field] == notif_thrshld or + limit_trip_repeats[packet.name][field] % notif_freq == 0: notify.trigger_notification('limit-error', msg) elif defn.warn(v): @@ -425,7 +427,8 @@ def telem_handler(session): limit_trip_repeats[packet.name][field] += 1 - if limit_trip_repeats[packet.name][field] == notif_thrshld: + if limit_trip_repeats[packet.name][field] == notif_thrshld or + limit_trip_repeats[packet.name][field] % notif_freq == 0: notify.trigger_notification('limit-warn', msg) else: