mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02:00
retry get_spam_score 1 more time
This commit is contained in:
parent
1c22e14f68
commit
01da9aafcd
@ -1642,7 +1642,7 @@ async def get_spam_score_async(message: Message) -> float:
|
|||||||
return -999
|
return -999
|
||||||
|
|
||||||
|
|
||||||
def get_spam_score(message: Message, email_log: EmailLog) -> float:
|
def get_spam_score(message: Message, email_log: EmailLog, can_retry=True) -> float:
|
||||||
LOG.debug("get spam score for %s", email_log)
|
LOG.debug("get spam score for %s", email_log)
|
||||||
sa_input = to_bytes(message)
|
sa_input = to_bytes(message)
|
||||||
|
|
||||||
@ -1658,8 +1658,13 @@ def get_spam_score(message: Message, email_log: EmailLog) -> float:
|
|||||||
LOG.d("SA report for %s, score %s. %s", email_log, score, sa.get_report_json())
|
LOG.d("SA report for %s, score %s. %s", email_log, score, sa.get_report_json())
|
||||||
return score
|
return score
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception("SpamAssassin exception")
|
if can_retry:
|
||||||
|
LOG.warning("SpamAssassin exception, retry")
|
||||||
|
time.sleep(3)
|
||||||
|
return get_spam_score(message, email_log, can_retry=False)
|
||||||
|
else:
|
||||||
# return a negative score so the message is always considered as ham
|
# return a negative score so the message is always considered as ham
|
||||||
|
LOG.exception("SpamAssassin exception, ignore spam check")
|
||||||
return -999
|
return -999
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user