We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9faf64 commit 9d7a1f4Copy full SHA for 9d7a1f4
nbclient/util.py
@@ -94,5 +94,9 @@ async def ensure_async(obj):
94
def run_hook(hook, *args):
95
if hook is None:
96
return
97
- loop = asyncio.get_event_loop()
98
- loop.call_soon(hook, *args)
+ if inspect.isawaitable(hook):
+ loop = asyncio.get_event_loop()
99
+ future = loop.run_in_executor(None, hook, *args)
100
+ else:
101
+ future = hook(*args)
102
+ asyncio.ensure_future(future)
0 commit comments