diff --git a/core/worker/worker.go b/core/worker/worker.go index c0c237f..bb01aee 100644 --- a/core/worker/worker.go +++ b/core/worker/worker.go @@ -97,18 +97,17 @@ func (w *Worker) Run(ctx context.Context) error { "wait", waitTimes, ) - select { - case <-wCtx.Done(): - return err - default: - } - waitSec := math.Pow(2, float64(waitTimes)) if waitSec > 60 { waitSec = constant.DefaultWaitTime } waitTimes++ - time.Sleep(time.Second * time.Duration(waitSec)) + + select { + case <-time.After(time.Second * time.Duration(waitSec)): + case <-wCtx.Done(): + return err + } continue } waitTimes = 0