You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix event loop thread-local context in process_ready_tasks
Set Python event loop in thread-local storage before processing async
tasks. process_ready_tasks runs on dirty NIF scheduler threads (named
'Dummy-X'), not the main thread, and Python's asyncio uses thread-local
storage for event loops.
The fix imports asyncio.events and sets:
- The current event loop via asyncio.set_event_loop()
- The running loop via events._set_running_loop()
This mirrors what Python's asyncio.run() does internally. The original
context is restored before releasing the GIL.
0 commit comments