Tornado 6.5 Documentation
(continued from previous page) async def main(): app = make_app() app.listen(8888) shutdown_event = asyncio.Event() await shutdown_event.wait() if __name__ == "__main__": asyncio.run(main()) The main coroutine function run forever. (and if you wish to have main exit early as a part of a graceful shutdown procedure, you can call shutdown_event.set() to make it exit). The Application object The Application object is datetime objects. tornado.platform.asyncio • The shutdown protocol for AddThreadSelectorEventLoop now requires the use of asyncio.run or asyncio.loop.shutdown_asyncgens to avoid leaking the thread. • Introduced0 码力 | 272 页 | 1.12 MB | 2 月前3Tornado 6.5 Documentation
]) async def main(): app = make_app() app.listen(8888) shutdown_event = asyncio.Event() await shutdown_event.wait() if __name__ == "__main__": asyncio.run(main()) The main function run forever. (and if you wish to have main exit early as a part of a graceful shutdown procedure, you can call shutdown_event.set() to make it exit).The Application object The Application object is responsible asyncio The shutdown protocol for AddThreadSelectorEventLoop now requires the use of asyncio.run [https://docs.python.org/3/library/asyncio-runner.html#asyncio.run] or asyncio.loop.shutdown_asyncgens [https://docs0 码力 | 437 页 | 405.14 KB | 2 月前3Rust 程序设计语言 简体中文版 1.85.0
join,这样这些线程 在关闭前将会执行完它们的请求。接着会为 ThreadPool 实现一个告诉线程它们应该停止接收 新请求并结束的方式。为了实践这些代码,修改服务端在优雅停机(graceful shutdown)之 前只接受两个请求。 在我们开始时需要注意的是:这一切都不会影响处理执行闭包的那部分代码因此如果我们在异 步运行时中使用线程池,所有操作也完全相同。 为 ThreadPool 实现 Drop0 码力 | 562 页 | 3.23 MB | 8 天前3
共 3 条
- 1