fix: avoid codebase-retrieval timeouts and release search DB handles#15
Open
wei500L wants to merge 1 commit intohsingjui:mainfrom
Open
fix: avoid codebase-retrieval timeouts and release search DB handles#15wei500L wants to merge 1 commit intohsingjui:mainfrom
wei500L wants to merge 1 commit intohsingjui:mainfrom
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.
变更摘要
这个 PR 主要解决两个问题:
codebase-retrieval在已有索引仓库上仍然同步触发增量索引,导致查询容易超时主要修改
1. 调整
codebase-retrieval的索引策略2. 强化项目锁实现
index在短超时下抢不到锁时会快速退出,不再长时间阻塞3. 修复检索链路的资源释放问题
SearchService增加显式close()ContextPacker在打包完成后关闭 SQLite 连接GraphExpander增加close(),并改为每次请求创建独立实例handleCodebaseRetrieval()在finally中统一释放检索阶段资源行为变化
验证
已完成以下验证:
pnpm build通过search请求可以快速返回,不再被同步增量索引阻塞handleCodebaseRetrieval()执行完成后,不再残留index.db/index.db-wal/index.db-shm句柄index子进程会快速退出,不会并发写同一个索引库风险说明