From ac6d1c110632e1505222029fc5b5116087bbde47 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Sun, 10 May 2020 10:34:39 +0200 Subject: [PATCH] able to set nb max alert in send_email_with_rate_control --- app/email_utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/email_utils.py b/app/email_utils.py index 922cfcc0..54b9d767 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -246,6 +246,7 @@ def send_email_with_rate_control( plaintext, html=None, bounced_email: Optional[Message] = None, + max_alert_24h=MAX_ALERT_24H, ) -> bool: """Same as send_email with rate control over alert_type. For now no more than _MAX_ALERT_24h alert can be sent in the last 24h @@ -260,7 +261,7 @@ def send_email_with_rate_control( .count() ) - if nb_alert > MAX_ALERT_24H: + if nb_alert > max_alert_24h: LOG.error( "%s emails were sent to %s in the last 24h, alert type %s", nb_alert,