Add RetryUntilSuccessOrExhausted and NonRetryableError to internal/common/util - #5085
Open
mauriceyap wants to merge 3 commits into
Open
Add RetryUntilSuccessOrExhausted and NonRetryableError to internal/common/util#5085mauriceyap wants to merge 3 commits into
mauriceyap wants to merge 3 commits into
Conversation
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
Contributor
Greptile SummaryAdds a bounded retry utility and sentinel-based non-retryable error handling.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the non-positive budget path now supplies a descriptive error, and the sentinel-based non-retryable API removes the nil-cause dereference path.
|
| Filename | Overview |
|---|---|
| internal/common/util/retry.go | Adds the bounded retry helper, sentinel-based short-circuiting, cancellation handling, and a descriptive zero-attempt exhaustion error; both previously reported defects are resolved. |
| internal/common/util/retry_test.go | Adds focused tests covering successful retries, exhaustion, cancellation, sentinel wrapping, and non-positive attempt budgets. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Start retry helper] --> B{Context cancelled?}
B -- Yes --> C[Return false]
B -- No --> D{Attempts available?}
D -- No --> E[Call onExhausted]
D -- Yes --> F[Perform action]
F --> G{Succeeded?}
G -- Yes --> H[Return true]
G -- No --> I{Error is non-retryable?}
I -- Yes --> E
I -- No --> J[Call onError]
J --> B
E --> K[Return false]
Reviews (7): Last reviewed commit: "ErrNonRetryable" | Re-trigger Greptile
mauriceyap
force-pushed
the
dlq-ingester-2
branch
from
August 3, 2026 13:40
39347d2 to
f83efa6
Compare
mauriceyap
force-pushed
the
dlq-ingester-2
branch
2 times, most recently
from
August 4, 2026 10:16
b995f3b to
74c6ce3
Compare
nikola-jokic
reviewed
Aug 4, 2026
nikola-jokic
left a comment
Contributor
There was a problem hiding this comment.
Added few suggestions that I think might be useful
nikola-jokic
approved these changes
Aug 5, 2026
mauriceyap
force-pushed
the
dlq-ingester-2
branch
from
August 5, 2026 15:53
4d33d58 to
c72f15e
Compare
|
…mmon/util Add a bounded-retry helpter which retries `performAction` up to `maxAttempts` times. It calls `onExhausted` with the last error if the budget runs out. It short-circuits immediately if the error is wrapped in the new `NonRetryableError`. This will be used in the ingestion pipeline to decide when to dead-leatter a message after retrying it. Signed-off-by: Maurice Yap <mauriceyap@hotmail.co.uk>
Signed-off-by: Maurice Yap <mauriceyap@hotmail.co.uk>
mauriceyap
force-pushed
the
dlq-ingester-2
branch
from
August 6, 2026 10:07
c72f15e to
b5dfb49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a bounded-retry helper which retries
performActionup tomaxAttemptstimes. It callsonExhaustedwith the last error if the budget runs out. It short-circuits immediately if the error is wrapped in the newNonRetryableError.This will be used in the ingestion pipeline to decide when to dead-letter a message after retrying it.