handle case spamassassin can't be reached

This commit is contained in:
Son NK 2020-08-16 21:54:19 +02:00
parent 735c0310fd
commit 24d8babe46
1 changed files with 4 additions and 1 deletions

View File

@ -1225,9 +1225,12 @@ async def get_spam_score(message: Message) -> float:
)
return response.headers["Spam"].score
except asyncio.TimeoutError:
LOG.warning("SpamAssassin timeout on: %s", message)
LOG.exception("SpamAssassin timeout")
# return a negative score so the message is always considered as ham
return -999
except Exception:
LOG.exception("SpamAssassin exception")
return -999
class MailHandler: