HomePhorge

Limit number of retries to send an update notification; fix the smtplib.SMTP.

Description

Limit number of retries to send an update notification; fix the smtplib.SMTP.sendmail() mock to also return success status

Event Timeline

The added "break" in line 1219 does not make sense to me here. Or I don't know python. Also, shouldn't the smtp.quit() be out of the loop?

The break statement simply gets us out of the while loop directly, omitting the time.sleep(10) and retries -= 1, returning whatever is the (boolean) result of smtp.sendmail().

smtp.sendmail() in turn should either return True, or remain False for all failures of smtp.sendmail() will trigger an exception.

Yes, I got it. What about smtp.quit()? Will smtp.sendmail() retry work if you quit the connection?