mirror of
https://github.com/gin-gonic/gin.git
synced 2026-04-29 23:23:18 +08:00
refactor: use the built-in max/min to simplify the code
Signed-off-by: tsinglua <tsinglua@outlook.com>
This commit is contained in:
parent
3e44fdc4d1
commit
c69d5a4b80
@ -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)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user