Skip to content

Commit

Permalink
use run_in_executor to run sync method in async method
Browse files Browse the repository at this point in the history
  • Loading branch information
raman325 committed Sep 18, 2020
1 parent 784e073 commit 8aa2bad
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 functools import partial
from ..URLBase import URLBase
from ..logger import logger

Expand Down Expand Up @@ -101,7 +102,8 @@ async def async_notify(self, *args, **kwargs): # noqa: E999
Async Notification Wrapper
"""
try:
return self.notify(*args, **kwargs)
loop = asyncio.get_event_loop()
return await loop.run_in_executor(None, partial(self.notify, *args, **kwargs))

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

0 comments on commit 8aa2bad

Please sign in to comment.