From f0e3cfe5f0779de03caf26c2f379919de2494523 Mon Sep 17 00:00:00 2001 From: Jan Losinski Date: Mon, 21 Jan 2019 21:46:55 +0100 Subject: [PATCH] Fix waiting for the wrong future type --- punkow/service/mailer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/punkow/service/mailer.py b/punkow/service/mailer.py index 5d08740..07dd4a7 100644 --- a/punkow/service/mailer.py +++ b/punkow/service/mailer.py @@ -3,6 +3,7 @@ from __future__ import annotations import asyncio import concurrent.futures import dataclasses +import functools import logging import os import smtplib @@ -107,7 +108,8 @@ class AsyncMailQueue(object): async def __aexit__(self, exc_type, exc_val, exc_tb): if len(self._queue) != 0: - await asyncio.gather(*self._queue) + await self._loop.run_in_executor(None, functools.partial( + concurrent.futures.wait(self._queue))) def _append_task(self, coro): self._queue.append(asyncio.run_coroutine_threadsafe(coro, self._loop))