From 78a2c3922b7df829ed7313d548c4a48c806da460 Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 11 May 2020 18:01:15 +0800 Subject: [PATCH] fix words for retrier pattern --- gomore/15_retrier/retrier.go | 2 +- gomore/15_retrier/retrier_test.go | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) 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