소스 검색

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,