diff --git a/gomore/15_retrier/retrier.go b/gomore/15_retrier/retrier.go index 6801c55..e93a53b 100644 --- a/gomore/15_retrier/retrier.go +++ b/gomore/15_retrier/retrier.go @@ -80,7 +80,7 @@ func (r *Retrier) sleep(ctx context.Context, t <-chan time.Time) error { } func (r *Retrier) calcSleep(i int) time.Duration { - // lock unsafe rand prng + // lock unsafe rand prog r.randMu.Lock() defer r.randMu.Unlock() // take a random float in the range (-r.jitter, +r.jitter) and multiply it by the base amount diff --git a/gomore/15_retrier/retrier_test.go b/gomore/15_retrier/retrier_test.go index aaa1d51..b19cd8d 100644 --- a/gomore/15_retrier/retrier_test.go +++ b/gomore/15_retrier/retrier_test.go @@ -1,3 +1,11 @@ +/* + * @Description: https://github.com/crazybber + * @Author: Edward + * @Date: 2020-05-11 17:43:55 + * @Last Modified by: Edward + * @Last Modified time: 2020-05-11 17:43:55 + */ + package retrier import ( @@ -7,7 +15,12 @@ import ( "time" ) -var i int +var ( + i int + errFoo = errors.New("work cancel") + errBar = errors.New("work cancel 2") + errBaz = errors.New("work cancel 3") +) func genWork(returns []error) func() error { i = 0