Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: 支持Graceful Shutdown(等待正在执行的matcher执行完毕后再退出) #2479

Open
ssttkkl opened this issue Dec 4, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@ssttkkl
Copy link
Contributor

ssttkkl commented Dec 4, 2023

希望能解决的问题

我有一个提供naga牌谱解析服务的插件 nonebot-plugin-nagabus 。解析需要消耗点数,换句话说就是要给naga送钱。所以希望退出时等待用户请求处理完毕再退出,否则用户消耗了点数又没拿到结果。

描述所需要的功能

当用户退出时,不希望打断当前正在执行的matcher,希望能够等待执行完毕后再退出

目前是通过hook丑陋地实现的( https://github.com/bot-ssttkkl/ssttkkl-nonebot-utils/blob/master/ssttkkl_nonebot_utils/interceptor/with_graceful_shutdown.py ),希望nb官方能够提供支持

@ssttkkl ssttkkl added the enhancement New feature or request label Dec 4, 2023
@yanyongyu
Copy link
Member

这个问题其实在之前改到结构化并发的时候就实现了,但是由于anyio的问题,这个分支最后被废弃了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants