sanity_check: alert when too many checks fail on a mailbox
This commit is contained in:
parent
b23259cacd
commit
28da78e75f
13
cron.py
13
cron.py
|
@ -279,12 +279,23 @@ def sanity_check():
|
|||
# hack to not query DNS too often
|
||||
sleep(1)
|
||||
if not email_domain_can_be_used_as_mailbox(mailbox.email):
|
||||
LOG.error(
|
||||
mailbox.nb_failed_checks += 1
|
||||
# alert if too much fail
|
||||
if mailbox.nb_failed_checks > 10:
|
||||
log_func = LOG.error
|
||||
else:
|
||||
log_func = LOG.warning
|
||||
|
||||
log_func(
|
||||
"issue with mailbox %s domain. #alias %s, nb email log %s",
|
||||
mailbox,
|
||||
mailbox.nb_alias(),
|
||||
mailbox.nb_email_log(),
|
||||
)
|
||||
else: # reset nb check
|
||||
mailbox.nb_failed_checks = 0
|
||||
|
||||
db.session.commit()
|
||||
|
||||
for user in User.filter_by(activated=True).all():
|
||||
if user.email.lower() != user.email:
|
||||
|
|
Loading…
Reference in New Issue