-
Notifications
You must be signed in to change notification settings - Fork 2.7k
fix(knowledge): prevent abnormal deletion of local SQL files during knowledge base removal #8151
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
base: main
Are you sure you want to change the base?
fix(knowledge): prevent abnormal deletion of local SQL files during knowledge base removal #8151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Provides robust cleanup when removing a knowledge base by closing database connections and retrying file deletions to avoid “file busy” errors.
- Track and reuse
RAGApplication
andLibSqlDb
instances per knowledge base - Close database client before removal and pause to ensure file handles are released
- Implement a retry loop with backoff for deleting the local storage directory
Comments suppressed due to low confidence (2)
src/main/services/KnowledgeService.ts:104
- [nitpick] Comments are in Chinese; consider translating to English to maintain consistency with the rest of the codebase.
// 存储数据库实例,用于后续关闭
src/main/services/KnowledgeService.ts:205
- The new retry logic isn’t covered by existing tests. Add unit or integration tests to simulate busy-file scenarios and verify correct retry behavior.
for (let i = 0; i < maxRetries; i++) {
cherry-studio/src/renderer/src/services/WebSearchService.ts Lines 222 to 230 in 71917eb
|
这个我还真没注意,我明天研究一下 |
好 |
What this PR does
Before this PR:
删除知识库时,对应的本地数据库可能会因为来不及释放文件占用而导致删除失败
After this PR:
删除前释放RagApplication占用,添加删除异常重试机制实现文件的正确删除
Fixes #7592
Why we need it and why it was done in this way
The following tradeoffs were made:
The following alternatives were considered:
Links to places where the discussion took place:
Breaking changes
If this PR introduces breaking changes, please describe the changes and the impact on users.
Special notes for your reviewer
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
Release note