fix: cleanup_ctx改为on_cleanup,修复hot_reload_cleanup coroutine未await错误

cleanup_ctx要求异步上下文管理器(需yield),但_hot_reload_cleanup是普通async def。
改用on_cleanup接受普通coroutine function。
This commit is contained in:
yumoqing 2026-06-01 22:47:01 +08:00
parent 0fd5ca9dc4
commit 4522a29ec6

View File

@ -149,7 +149,7 @@ class ConfiguredServer:
except asyncio.CancelledError:
pass
self.app.on_startup.append(_hot_reload_startup)
self.app.cleanup_ctx.append(_hot_reload_cleanup)
self.app.on_cleanup.append(_hot_reload_cleanup)
print(f'hot_reload enabled, interval={interval}s, endpoint=GET /__hot_reload__')
web.run_app(self.build_app(),host=config.website.host or '0.0.0.0',