Closed mcmtroffaes closed 2 years ago
I must admit that I'm not sure whether this is the right solution; it might be better to await for the relevant background task to complete instead, before closing. But I haven't figured out which task it is that is running, as I'm still learning to properly debug async programs.
I confirmed all tasks (after applying #247) are closed, at least in the simple test program. The exception appears to be due to an upstream bug related to the event loop implementation in cpython on windows: https://bugs.python.org/issue39232
It seems fine for bot.run()
function to call loop.close()
since asyncio.run(...)
does exactly the same. So closing this PR. Hopefully without runtime errors. 😉
Pull request summary
As noted in #247, when exiting the bot, a runtime error is given. This appears to be caused by the run function explicitly closing the event loop, whilst some background tasks are still running on the event loop.
Checklist