From 1415b8e37fdb5de07eb1da409588a621e34ff286 Mon Sep 17 00:00:00 2001 From: Jan Losinski Date: Mon, 21 Jan 2019 22:22:47 +0100 Subject: [PATCH] Don't crash if mail delivery failed --- punkow/service/mailer.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/punkow/service/mailer.py b/punkow/service/mailer.py index 9d4f99e..48d8755 100644 --- a/punkow/service/mailer.py +++ b/punkow/service/mailer.py @@ -108,8 +108,11 @@ class AsyncMailQueue(object): async def __aexit__(self, exc_type, exc_val, exc_tb): if len(self._queue) != 0: - await self._loop.run_in_executor(None, functools.partial( - concurrent.futures.wait, self._queue)) + try: + await self._loop.run_in_executor(None, functools.partial( + concurrent.futures.wait, self._queue)) + except: + logger.exception("Exception in waiting for mail sending") def _append_task(self, coro): self._queue.append(asyncio.run_coroutine_threadsafe(coro, self._loop))