From c2e03854ef8a13970059fac85d0a1223f38bf940 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Sun, 11 Oct 2020 18:11:49 +0200 Subject: [PATCH] refactor monitoring --- monitoring.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monitoring.py b/monitoring.py index 4f1f1053..316d601c 100644 --- a/monitoring.py +++ b/monitoring.py @@ -15,6 +15,9 @@ _nb_failed = 0 _max_nb_fails = 10 +# the maximum number of emails in incoming & active queue +_max_incoming_active = 50 + def get_stats(): """Look at different metrics and alert appropriately""" @@ -33,8 +36,7 @@ def get_stats(): global _nb_failed # alert when too many emails in incoming + active queue - # 50 is an arbitrary number here - if incoming_queue + active_queue > 50: + if incoming_queue + active_queue > _max_incoming_active: _nb_failed += 1 if _nb_failed > _max_nb_fails: