fix(delay): write pending state once per node in batch checks

checkListDelay pre-marked every node as checking, help() re-marked it
when picked up and measureDelay marked it a third time on entry, so
each batch run queued three identical pending updates per node. Keep
the pre-mark (immediate feedback for queued nodes) and drop the
redundant marks along the chain.
This commit is contained in:
Tunglies
2026-10-28 09:27:29 +08:00
parent d5bc4ff58b
commit c678d60964
+2 -4
View File
@@ -277,6 +277,8 @@ class DelayManager {
group: string,
timeout: number,
): Promise<DelayUpdate> {
// Entry points own the pending mark; measureDelay only writes results.
this.setDelay(member.ref.name, group, -2)
const update = await this.measureDelay(member, group, timeout)
this.queueGroupNotification(group)
return update
@@ -298,8 +300,6 @@ class DelayManager {
`[DelayManager] 开始测试延迟,代理: ${name}, 组: ${group}, 超时: ${timeout}ms`,
)
this.setDelay(name, group, -2)
const startTime = Date.now()
try {
@@ -359,8 +359,6 @@ class DelayManager {
const currName = currMember.ref.name
try {
this.setDelay(currName, group, -2)
// Stagger requests so a batch does not hit the core at once.
if (index > 1) {
await new Promise((resolve) =>