fix: 修复 EventsManager 任务清理时 Key 不一致#1518
Open
KeepingRunning wants to merge 1 commit intoMai-with-u:devfrom
Open
fix: 修复 EventsManager 任务清理时 Key 不一致#1518KeepingRunning wants to merge 1 commit intoMai-with-u:devfrom
KeepingRunning wants to merge 1 commit intoMai-with-u:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
请填写以下内容
(删除掉中括号内的空格,并替换为小写的x)
main分支 禁止修改,请确认本次提交的分支 不是main分支修复 EventsManager 中异步任务清理逻辑 Key 值不一致导致的 KeyError 问题。
问题现象:原代码在 _dispatch_handler_task 中使用 handler_name 作为 key 存储任务,但在 _task_done_callback 中却尝试使用 task.get_name()(包含 plugin 前缀)作为 key 移除任务,导致回调执行时任务无法被正常清理。
修复方案:通过闭包将确定的 handler_name 传递给回调函数,确保插入和删除使用的 key 完全一致。
优化:在回调中增加了对空任务列表的自动删除逻辑,避免 _handler_tasks 字典无效膨胀。
其他信息