Skip to content

Commit

Permalink
add ThreadPoolExecutor
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 committed Sep 18, 2020
1 parent 8aa2bad commit 1548ade
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apprise/py3compat/asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import sys
import asyncio
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from ..URLBase import URLBase
from ..logger import logger
Expand Down Expand Up @@ -103,7 +104,8 @@ async def async_notify(self, *args, **kwargs): # noqa: E999
"""
try:
loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, partial(self.notify, *args, **kwargs))
executor = ThreadPoolExecutor(3)
return await loop.run_in_executor(executor, partial(self.notify, *args, **kwargs))

except TypeError:
# These our our internally thrown notifications
Expand Down

0 comments on commit 1548ade

Please sign in to comment.