mik-laj commented on a change in pull request #12801:
URL: https://github.com/apache/airflow/pull/12801#discussion_r536074269
##########
File path: airflow/utils/email.py
##########
@@ -178,14 +180,23 @@ def send_mime_email(e_from: str, e_to: List[str],
mime_msg: MIMEMultipart, dryru
log.debug("No user/password found for SMTP, so logging in with no
authentication.")
if not dryrun:
- conn = smtplib.SMTP_SSL(smtp_host, smtp_port) if smtp_ssl else
smtplib.SMTP(smtp_host, smtp_port)
- if smtp_starttls:
- conn.starttls()
- if smtp_user and smtp_password:
- conn.login(smtp_user, smtp_password)
- log.info("Sent an alert email to %s", e_to)
- conn.sendmail(e_from, e_to, mime_msg.as_string())
- conn.quit()
+ for attempt in range(smtp_retry_limit):
Review comment:
Yes. I thought about `range(1, smtp_retry_limit+1)`. to reduce the need
to do math. We need this counter to count attempts, not to access arrays, so I
think the counter starting with 1 is a better solution. Plus, this PR looks
good and I'd love to merge it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]