فهرست منبع

able to set nb max alert in send_email_with_rate_control

Son NK 5 سال پیش
والد
کامیت
ac6d1c1106
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      app/email_utils.py

+ 2 - 1
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,