[V3] Clean up shutdown exceptions (#1141)

This commit is contained in:
Tobotimus 2017-12-09 11:24:57 +11:00 committed by Will
parent 878d10a1e2
commit ef7216722f

View File

@ -157,10 +157,9 @@ def main():
rpc.clean_up() rpc.clean_up()
if cleanup_tasks: if cleanup_tasks:
pending = asyncio.Task.all_tasks(loop=red.loop) pending = asyncio.Task.all_tasks(loop=red.loop)
gathered = asyncio.gather(*pending, loop=red.loop) gathered = asyncio.gather(
*pending, loop=red.loop, return_exceptions=True)
gathered.cancel() gathered.cancel()
red.loop.run_until_complete(gathered)
gathered.exception()
sys.exit(red._shutdown_mode.value) sys.exit(red._shutdown_mode.value)