mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-06 01:12:33 -05:00
[Core] Properly end tasks and process flusher's queue on quit
This commit is contained in:
5
main.py
5
main.py
@@ -85,5 +85,10 @@ if __name__ == '__main__':
|
||||
log.critical("Fatal exception", exc_info=e)
|
||||
loop.run_until_complete(red.logout())
|
||||
finally:
|
||||
pending = asyncio.Task.all_tasks(loop=red.loop)
|
||||
gathered = asyncio.gather(*pending, loop=red.loop)
|
||||
gathered.cancel()
|
||||
red.loop.run_until_complete(gathered)
|
||||
gathered.exception()
|
||||
sys.exit(red._shutdown_mode.value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user