feat(async/unstable): add onRetry option to retry() - #7297
Open
tomas-zijdemans wants to merge 1 commit into
Open
feat(async/unstable): add onRetry option to retry()#7297tomas-zijdemans wants to merge 1 commit into
retry()#7297tomas-zijdemans wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7297 +/- ##
==========================================
- Coverage 95.03% 94.99% -0.05%
==========================================
Files 617 619 +2
Lines 51637 51957 +320
Branches 9359 9426 +67
==========================================
+ Hits 49075 49355 +280
- Misses 2021 2048 +27
- Partials 541 554 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Adds an unstable
onRetrycallback toretry()so callers can log or measure retries without abusingisRetriable. Stableretrystays untouched.Why
isRetriable(error)runs before the attempts-remaining check, so it also sees the terminal failure that becomesRetryError. It cannot tell whether another attempt will follow.onRetrycan. It fires after the retry decision is final, immediately before the backoff sleep.API
attemptis the 1-based number of the failed attempt.delayis the post-jitter delay passed to the sleep.isRetriable, or an already-aborted signal.The callback observes a retry but cannot veto it or change its delay.
Review and testing
unstable_retry.tsfollows the unstable-first pattern previously used forisRetriableandsignal.Ten tests cover arguments, timing, terminal failure, rejected errors, and abort behavior.
deno task okpasses.