修复两个 bug:重试误判 + 任务饥饿#23
Open
BanYeHanFeng wants to merge 1 commit into
Open
Conversation
BanYeHanFeng
force-pushed
the
upstream-prep
branch
from
July 2, 2026 19:08
4dc4200 to
4f2ca8c
Compare
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.
修复一:TryRespond 成功后 Closed 被误判重试
根因:
TryRespond()发送 HTTP 响应后将task.state从Completed改为Closed,并从taskDatas中移除该任务。finally块的重试判断仅跳过Completed,导致Closed被误判为失败而进入重试分支。影响:成功任务在
finally中被错误重置state=Waiting、清空result、retryCount误增。因任务此时已从taskDatas移除,不会重新入队翻译,但其内部状态被污染(retryCount累积错误、result被清空)。修复(1 行):
修复二:SelectTasks retryCount>2 任务被混批
根因:
retryCount>2的文本被设计为不与其他任务混批(隔离处理),但实现用continue跳过当前任务后继续收集后续任务,导致该高重试任务被跳过、而其后的任务被混入同一批次,破坏了隔离语义。修复(1 行):
if (task.retryCount > 2 && tasks.Count > 0) { - continue; + break; }改为
break终止当前批次收集,使该高重试任务在下轮SelectTasks中作为首位被单独选中处理,保持原有的隔离语义。两个修复均来自实际使用中发现并验证,改动各一行,零副作用。