fix(storage): 按事件循环隔离异步客户端#2168
Merged
Merged
Conversation
Cache async SDK clients per event loop to avoid cross-loop reuse in worker threads. Move memory vectorization into semantic queue refresh and preserve target sync state for resource updates.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
zhoujh01
approved these changes
May 21, 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.
Description
修复异步 Embedding/VLM 客户端在多线程、多事件循环场景下复用同一个 async client 的问题,并调整语义刷新链路,让 memory 文件向量化和 resource temp -> target 同步都在语义队列处理中保持一致。
Related Issue
Fixes #2135
Type of Change
Changes Made
LoopScopedAsyncClientCache,让httpx.AsyncClient、OpenAI/Ark 等异步客户端按当前事件循环缓存,避免跨 worker thread/event loop 复用导致运行时错误。SemanticProcessor,使用生成后的 summary 对变更文件向量化,并保留目录级向量刷新。target_preexisting和sync_to_target,确保 full update 仍可在语义生成持有资源锁时完成 temp -> target 同步,同时保留已有 target 的 incremental 判断。Testing
执行过:
结果:
78 passed, 4 warnings in 8.55s。warnings 为现有依赖/Pydantic deprecation 类提示。Checklist
Screenshots (if applicable)
不适用
Additional Notes
本地 pre-commit hook 绑定的系统 Python 和当前
.venv都没有安装pre_commit模块,因此提交时使用了--no-verify;相关测试已在本地通过。