mirror of
https://github.com/gin-gonic/gin.git
synced 2026-04-11 02:01:52 +08:00
refactor(test): use the built-in max/min to simplify the code (#4576)
Signed-off-by: tsinglua <tsinglua@outlook.com> Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
48667a2dd1
commit
6d880724cc
@ -49,10 +49,7 @@ func waitForServerReady(url string, maxAttempts int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Exponential backoff: 10ms, 20ms, 40ms, 80ms, 160ms...
|
// Exponential backoff: 10ms, 20ms, 40ms, 80ms, 160ms...
|
||||||
backoff := time.Duration(10*(1<<uint(i))) * time.Millisecond
|
backoff := min(time.Duration(10*(1<<uint(i)))*time.Millisecond, 500*time.Millisecond)
|
||||||
if backoff > 500*time.Millisecond {
|
|
||||||
backoff = 500 * time.Millisecond
|
|
||||||
}
|
|
||||||
time.Sleep(backoff)
|
time.Sleep(backoff)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user