Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add check context cancel #2596

Merged
merged 10 commits into from
Sep 12, 2024
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions internal/backoff/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@
} 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)

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

View check run for this annotation

Codecov / codecov/patch

internal/backoff/backoff.go#L189-L198

Added lines #L189 - L198 were not covered by tests
}
default:
}
kmrmt marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Expand Down
Loading