fix(backend): 停机预热任务回收异常隔离与超时兜底 - #77
Merged
Merged
Conversation
6 tasks
This was referenced Sep 27, 2026
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.
What & why
修复 #73 / 矩阵 D-10 的两处停机链中断点:
_cache_warmup_taskcancel 后仅suppress(CancelledError)——任务若以非取消异常完成,await 再抛会跳过调度器停机、drain、DuckDB 关闭、engine.dispose 全部余下清理;to_thread不可取消,词典加载卡住会挂死整个优雅停机。修复:提取
_shutdown_prewarm_tasks辅助函数——缓存任务异常只记 warning 不外抛(含已完成带异常的任务也必须 await 取回,避免静默丢失);jieba 走wait_for10s 超时兜底。Refs #73(Parent #6)。Closes #73。
Area
Verification
tests/test_shutdown_prewarm.py:异常不外抛且留痕 / jieba 超时不挂死(外层 wait_for 5s 反证)/ 正常与已取消路径静默ruff check+ruff format --check通过Verifier verdict
CI 门禁即机器 Verifier;停机隔离契约由独立单测钉死。
Checklist
issue-<number>-<short-slug>and PR links the issue