-
In actual execution, Is there any difference between method1 and method2 ? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 8 replies
-
Hi @zcattacz, if you, use the _wrapper2, that is a synchronous function, it will block the execution of the code until wrapped_fn completes. It would be more appropriate to use method 1. This way, you can handle the asynchronous code properly and ensure the execution flow is not blocked. |
Beta Was this translation helpful? Give feedback.
-
I think they work the same, here is the toy code I used to test my assumption. The inner asyncio.sleep seems to pause code execution up to the coro task from which the intermediate synchronous function is invoked from, which is what I need. It seems to work just like called from a chain of async functions.
|
Beta Was this translation helpful? Give feedback.
-
When
|
Beta Was this translation helpful? Give feedback.
-
In general there is no need to use |
Beta Was this translation helpful? Give feedback.
-
Yes, it's difficult to mix async with sync, and rightly so, async is best if used with async. For testing purposes I have wrapped async functions in asyncio.run(coro()) |
Beta Was this translation helpful? Give feedback.
-
Having followed this thread I still don't understand your overall system design. Evidently your application runs under |
Beta Was this translation helpful? Give feedback.
False claim, not supposed to work (check issue #8515), will cause unpredicated behaviour.