Skip to content

Commit 88f4803

Browse files
committed
Remove nil-check on last received error
1 parent 2c8fcf4 commit 88f4803

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

retrier/retrier.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func (r *Retrier) WithInfiniteRetry() *Retrier {
4444
return r
4545
}
4646

47-
// WithSurfaceWorkErrors configures the retrier to always return the last non-nil error received from work()
47+
// WithSurfaceWorkErrors configures the retrier to always return the last error received from work function
4848
// even if a context timeout/deadline is hit.
4949
func (r *Retrier) WithSurfaceWorkErrors() *Retrier {
5050
r.surfaceWorkErrors = true
@@ -91,7 +91,7 @@ func (r *Retrier) RunFn(ctx context.Context, work func(ctx context.Context, retr
9191

9292
timer := time.NewTimer(r.calcSleep(retries))
9393
if err := r.sleep(ctx, timer); err != nil {
94-
if r.surfaceWorkErrors && ret != nil {
94+
if r.surfaceWorkErrors {
9595
return ret
9696
}
9797
return err

0 commit comments

Comments
 (0)