chore: update linter.
This commit is contained in:
parent
d698eba1e7
commit
a20e90aa17
91 changed files with 646 additions and 459 deletions
|
@ -6,9 +6,7 @@ import (
|
|||
"github.com/cenkalti/backoff/v4"
|
||||
)
|
||||
|
||||
var (
|
||||
_ backoff.BackOff = (*BackOff)(nil)
|
||||
)
|
||||
var _ backoff.BackOff = (*BackOff)(nil)
|
||||
|
||||
const (
|
||||
defaultMinJobInterval = 30 * time.Second
|
||||
|
|
|
@ -24,21 +24,21 @@ func TestJobBackOff(t *testing.T) {
|
|||
exp.MinJobInterval = testMinJobInterval
|
||||
exp.Reset()
|
||||
|
||||
var expectedResults = []time.Duration{500, 500, 500, 1000, 2000, 4000, 5000, 5000, 500, 1000, 2000, 4000, 5000, 5000}
|
||||
expectedResults := []time.Duration{500, 500, 500, 1000, 2000, 4000, 5000, 5000, 500, 1000, 2000, 4000, 5000, 5000}
|
||||
for i, d := range expectedResults {
|
||||
expectedResults[i] = d * time.Millisecond
|
||||
}
|
||||
|
||||
for i, expected := range expectedResults {
|
||||
// Assert that the next backoff falls in the expected range.
|
||||
var minInterval = expected - time.Duration(testRandomizationFactor*float64(expected))
|
||||
var maxInterval = expected + time.Duration(testRandomizationFactor*float64(expected))
|
||||
minInterval := expected - time.Duration(testRandomizationFactor*float64(expected))
|
||||
maxInterval := expected + time.Duration(testRandomizationFactor*float64(expected))
|
||||
|
||||
if i < 3 || i == 8 {
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
|
||||
var actualInterval = exp.NextBackOff()
|
||||
actualInterval := exp.NextBackOff()
|
||||
if !(minInterval <= actualInterval && actualInterval <= maxInterval) {
|
||||
t.Error("error")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue