perf(polling): visibility 暂停 + TranslationPanel 超时 + request 套 retryAsync - #44
Merged
Conversation
…sync PR4 — 轮询优化 GlobalTaskContext: - 加 visibilitychange 监听,document.hidden 时停止轮询,恢复可见时立即拉+重启 (此前后台标签 360-1800 次/小时冗余 /tasks/active 请求降为 0) Sidebar: - folderStats 60s 轮询加 visibility 暂停(此前后台 60 次/小时冗余) TranslationPanel: - 轮询加 5 分钟超时 + 连续错误 10 次上限(此前无超时,任务挂起时 1800 次/小时泄漏) - pollRef 持有定时器 + 卸载 cleanup(此前闭包内局部变量,卸载无法清) - alert 改 toast(与 app 风格统一) CitationPanel: - 导入轮询间隔 1s→2s + 加 5 分钟超时(此前 1s 偏激进,无超时兜底) api.ts request 套 retryAsync: - get 套 retryAsync(3 次指数退避,仅 NETWORK/SERVER/timeout 重试) 瞬时故障从 100% 失败降到 ~0.1% - POST/PATCH/PUT/DELETE 不套(非幂等,重试可能导致重复写入) - 复用已写好未用的 errorHandler.retryAsync
🔍 OpenCode PR Review Required这是一个受保护的分支,merge 前需要进行 code review。 请运行以下命令进行 OpenCode review: 或者在 PR 页面评论 This is an automated reminder from PR Review Gate. |
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.
PR4 — 轮询优化(中风险)
GlobalTaskContext
Sidebar
TranslationPanel
CitationPanel
api.ts
验证