When shutting down an EventSubWebhook eventsub class with await stop(), it attempts to call things running in a different event loop. This is because for some reason the webhook operates in a dedicated event loop on a different thread. Additionally, it uses asyncio.set_event_loop, which further modifies the user's asyncio state. This does not appear to be documented anywhere.
The only way to avoid a RuntimeError being thrown when calling await stop() in my case is to perform the following:
asyncio.run_coroutine_threadsafe(eventsub.stop(), eventsub._EventSubWebhook__hook_loop).result(timeout = 5)
Unfortunately though, due to the bugginess of this whole thing, I can't safely use this library. Why can it not just use the currently running event loop?
When shutting down an EventSubWebhook eventsub class with
await stop(), it attempts to call things running in a different event loop. This is because for some reason the webhook operates in a dedicated event loop on a different thread. Additionally, it usesasyncio.set_event_loop, which further modifies the user's asyncio state. This does not appear to be documented anywhere.The only way to avoid a
RuntimeErrorbeing thrown when callingawait stop()in my case is to perform the following:asyncio.run_coroutine_threadsafe(eventsub.stop(), eventsub._EventSubWebhook__hook_loop).result(timeout = 5)Unfortunately though, due to the bugginess of this whole thing, I can't safely use this library. Why can it not just use the currently running event loop?