refactor: use the built-in max/min to simplify the code

Signed-off-by: tsinglua <tsinglua@outlook.com>
This commit is contained in:
tsinglua 2026-03-11 16:37:08 +08:00
parent 3e44fdc4d1
commit c69d5a4b80

View File

@ -49,10 +49,7 @@ func waitForServerReady(url string, maxAttempts int) error {
}
// Exponential backoff: 10ms, 20ms, 40ms, 80ms, 160ms...
backoff := time.Duration(10*(1<<uint(i))) * time.Millisecond
if backoff > 500*time.Millisecond {
backoff = 500 * time.Millisecond
}
backoff := min(time.Duration(10*(1<<uint(i)))*time.Millisecond, 500*time.Millisecond)
time.Sleep(backoff)
}