Fix bug in nyasync where it would use the asyncio event loop set at function define time
This commit is contained in:
@@ -2,8 +2,8 @@ import asyncio
|
|||||||
|
|
||||||
def ify(func):
|
def ify(func):
|
||||||
"""Decorate func to run async in default executor"""
|
"""Decorate func to run async in default executor"""
|
||||||
asyncloop = asyncio.get_event_loop()
|
|
||||||
async def asyncified(*args, **kwargs):
|
async def asyncified(*args, **kwargs):
|
||||||
|
asyncloop = asyncio.get_event_loop()
|
||||||
return await asyncloop.run_in_executor(
|
return await asyncloop.run_in_executor(
|
||||||
None, lambda: func(*args, **kwargs))
|
None, lambda: func(*args, **kwargs))
|
||||||
return asyncified
|
return asyncified
|
||||||
|
|||||||
Reference in New Issue
Block a user