Skip to content
Myr

refactor(test): use the built-in max/min to simplify the code (#4576)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by tsinglua · committed by GitHub · parent 48667a2 · Browse files · 1 file+1 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: tsinglua <tsinglua@outlook.com>
  • Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Diff stats

1 file+1 added−4 removed

  • other:+1 added−4 removed

1 file+1 added−4 removed

modified:test_helpers.go+1 added-4 removed
47 unmodified lines
48 return nil49 }5051 // Exponential backoff: 10ms, 20ms, 40ms, 80ms, 160ms...52 backoff := time.Duration(10*(1<<uint(i))) * time.Millisecond53 if backoff > 500*time.Millisecond {54 backoff = 500 * time.Millisecond55 }52 backoff := min(time.Duration(10*(1<<uint(i)))*time.Millisecond, 500*time.Millisecond)53 time.Sleep(backoff)54 }5556 return fmt.Errorf("server at %s did not become ready after %d attempts", url, maxAttempts)
1 unmodified line