1
0
mirror of https://github.com/janLo/punkow synced 2026-06-19 15:38:00 +00:00

Fix waiting for the wrong future type

This commit is contained in:
2019-01-21 21:46:55 +01:00
parent 65cffd1ca8
commit f0e3cfe5f0
+3 -1
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
import asyncio import asyncio
import concurrent.futures import concurrent.futures
import dataclasses import dataclasses
import functools
import logging import logging
import os import os
import smtplib import smtplib
@@ -107,7 +108,8 @@ class AsyncMailQueue(object):
async def __aexit__(self, exc_type, exc_val, exc_tb): async def __aexit__(self, exc_type, exc_val, exc_tb):
if len(self._queue) != 0: 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): def _append_task(self, coro):
self._queue.append(asyncio.run_coroutine_threadsafe(coro, self._loop)) self._queue.append(asyncio.run_coroutine_threadsafe(coro, self._loop))