refactor
This commit is contained in:
parent
73d781cf6b
commit
94bbade62e
21
cron.py
21
cron.py
|
@ -720,10 +720,20 @@ def check_mailbox_valid_domain():
|
||||||
if not mailbox:
|
if not mailbox:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not email_can_be_used_as_mailbox(mailbox.email):
|
if email_can_be_used_as_mailbox(mailbox.email):
|
||||||
|
LOG.d("Mailbox %s valid", mailbox)
|
||||||
|
mailbox.nb_failed_checks = 0
|
||||||
|
else:
|
||||||
mailbox.nb_failed_checks += 1
|
mailbox.nb_failed_checks += 1
|
||||||
nb_email_log = nb_email_log_for_mailbox(mailbox)
|
nb_email_log = nb_email_log_for_mailbox(mailbox)
|
||||||
|
|
||||||
|
LOG.w(
|
||||||
|
"issue with mailbox %s domain. #alias %s, nb email log %s",
|
||||||
|
mailbox,
|
||||||
|
mailbox.nb_alias(),
|
||||||
|
nb_email_log,
|
||||||
|
)
|
||||||
|
|
||||||
# send a warning
|
# send a warning
|
||||||
if mailbox.nb_failed_checks == 5:
|
if mailbox.nb_failed_checks == 5:
|
||||||
if mailbox.user.email != mailbox.email:
|
if mailbox.user.email != mailbox.email:
|
||||||
|
@ -756,15 +766,6 @@ def check_mailbox_valid_domain():
|
||||||
retries=3,
|
retries=3,
|
||||||
)
|
)
|
||||||
|
|
||||||
LOG.w(
|
|
||||||
"issue with mailbox %s domain. #alias %s, nb email log %s",
|
|
||||||
mailbox,
|
|
||||||
mailbox.nb_alias(),
|
|
||||||
nb_email_log,
|
|
||||||
)
|
|
||||||
else: # reset nb check
|
|
||||||
mailbox.nb_failed_checks = 0
|
|
||||||
|
|
||||||
Session.commit()
|
Session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue