Fix bug in nyasync where it would use the asyncio event loop set at function define time

This commit is contained in:
Peder Bergebakken Sundt 2018-03-05 23:12:07 +01:00
parent 52245b1256
commit 33be49d2d3
1 changed files with 1 additions and 1 deletions

View File

@ -2,8 +2,8 @@ import asyncio
def ify(func):
"""Decorate func to run async in default executor"""
asyncloop = asyncio.get_event_loop()
async def asyncified(*args, **kwargs):
asyncloop = asyncio.get_event_loop()
return await asyncloop.run_in_executor(
None, lambda: func(*args, **kwargs))
return asyncified