Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Kosuke Morimoto <[email protected]>
  • Loading branch information
kmrmt committed Sep 9, 2024
1 parent e948201 commit cdfdfc3
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions internal/backoff/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,25 @@ func (b *backoff) Do(
dur *= b.backoffFactor
jdur = b.addJitter(dur)
}
if cnt >= b.maxRetryCount-1 {
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)

Check warning on line 200 in internal/backoff/backoff.go

View check run for this annotation

Codecov / codecov/patch

internal/backoff/backoff.go#L196-L200

Added lines #L196 - L200 were not covered by tests
}
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
}

Expand Down

0 comments on commit cdfdfc3

Please sign in to comment.