fix: a sub-millisecond URL test is reported as a failure (#3316)

This commit is contained in:
Token authored and GitHub committed 2026-10-13 20:10:59 +08:00
1 parent 349af19116
commit df1b07af2c
1 file changed
+5
+5
View File
@@ -275,6 +275,11 @@ func (p *Proxy) URLTest(ctx context.Context, url string, expectedStatus utils.In
satisfied = resp != nil && (expectedStatus == nil || expectedStatus.Check(uint16(resp.StatusCode)))
t = uint16(time.Since(start) / time.Millisecond)
if t == 0 {
// a zero delay means a failed test to callers, so report a test
// that completed in under a millisecond as 1 ms
t = 1
}
return
}