Skip to content

如何优雅地退出后台守护运行的nonebot v1程序 #157

Answered by yanyongyu
CJReinforce asked this question in 问答
Discussion options

You must be logged in to vote

或许可以使用以下代码,在关闭时处理数据库连接

@get_bot().server_app.after_serving
async def shutdown():
    ...

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@CJReinforce
Comment options

@mnixry
Comment options

@CJReinforce
Comment options

@yanyongyu
Comment options

Answer selected by CJReinforce
Comment options

You must be logged in to vote
2 replies
@2catycm
Comment options

@yanyongyu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
问答
Labels
None yet
4 participants