Gracefully shutdown inside a event loop


Author: yifei / Created: June 18, 2017, 4:37 p.m. / Modified: June 18, 2017, 4:38 p.m. / Edit

try:
    loop.run_forever()
finally:
    loop.run_until_complete(loop.shutdown_asyncgens())
    loop.close()

评论区