mirror of
https://github.com/simple-login/app.git
synced 2025-02-22 23:02:55 +08:00
refactor
This commit is contained in:
parent
73d781cf6b
commit
94bbade62e
1 changed files with 11 additions and 10 deletions
21
cron.py
21
cron.py
|
@ -720,10 +720,20 @@ def check_mailbox_valid_domain():
|
|||
if not mailbox:
|
||||
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
|
||||
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
|
||||
if mailbox.nb_failed_checks == 5:
|
||||
if mailbox.user.email != mailbox.email:
|
||||
|
@ -756,15 +766,6 @@ def check_mailbox_valid_domain():
|
|||
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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue