Skip to content
Discussion options

You must be logged in to vote

@phy25 Thanks a lot for the fast response !
tl;dr changed to run_in_threadpool inside async def - worked !

After reading #1066, #825 and this post looks like the right way to go is to change the path operation to be async (async def) and use run_in_threadpool for the sync code.
I've verified it to be working both for the minified example, and for my production system.

Indeed my use of asyncio.run starts a separate loop, TBH my first try was to do asyncio.get_running_loop() but I got an exception claiming there's no running loop, so I thought that since I'm in a different thread I need to start a new loop.
I can't say I fully understand what's going on under the hood here that causes this …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@YuriiMotov
Comment options

Answer selected by YuriiMotov
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem question-migrate
4 participants
Converted from issue

This discussion was converted from issue #1475 on February 28, 2023 08:44.