-
Notifications
You must be signed in to change notification settings - Fork 224
Description
For many API methods, we expose a sync version and an async version, and the sync version usually call the async version by execution_context.run(...)
(call sites - i.e. use the event loop managed by cocoindex library.
If users mistakenly call the sync version within an async context, the best case is other coroutines at the context will be blocked for a while, the worst case is deadlock - if they're already in the same async context managed by cocoindex.
We want to update this _ExecutionContext.run()
method to check if it's already within an event loop:
- If it's already on the same event loop, raise an error.
- If it's on a different event loop, log a warning.
❤️ Contributors, please refer to 📙Contributing Guide.
Unless the PR can be sent immediately (e.g. just a few lines of code), we recommend you to leave a comment on the issue like I'm working on it
or Can I work on this issue?
to avoid duplicating work. Our Discord server is always open and friendly.