From e94820142389313e8e9624c851cdfb976830d160 Mon Sep 17 00:00:00 2001 From: Kosuke Morimoto Date: Fri, 6 Sep 2024 18:39:55 +0900 Subject: [PATCH] fix Signed-off-by: Kosuke Morimoto --- internal/backoff/backoff.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/backoff/backoff.go b/internal/backoff/backoff.go index d0cc283497..2d7860b120 100644 --- a/internal/backoff/backoff.go +++ b/internal/backoff/backoff.go @@ -185,24 +185,24 @@ func (b *backoff) Do( } else { dur *= b.backoffFactor jdur = b.addJitter(dur) - select { - case <-dctx.Done(): - switch dctx.Err() { - case context.DeadlineExceeded: - log.Debugf("[backoff]\tfor: "+name+",\tDeadline Exceeded\terror: %v", err.Error()) - return nil, errors.ErrBackoffTimeout(err) - case context.Canceled: - log.Debugf("[backoff]\tfor: "+name+",\tCanceled\terror: %v", err.Error()) - return nil, err - default: - return nil, errors.Join(dctx.Err(), err) - } - default: - } } } } } + select { + case <-dctx.Done(): + switch dctx.Err() { + case context.DeadlineExceeded: + log.Debugf("[backoff]\tfor: "+name+",\tDeadline Exceeded\terror: %v", err.Error()) + return nil, errors.ErrBackoffTimeout(err) + case context.Canceled: + log.Debugf("[backoff]\tfor: "+name+",\tCanceled\terror: %v", err.Error()) + return nil, err + default: + return nil, errors.Join(dctx.Err(), err) + } + default: + } return res, err }