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

feat: support retry function #253

Closed
wants to merge 1 commit into from
Closed

feat: support retry function #253

wants to merge 1 commit into from

Conversation

jenjen75
Copy link

@jenjen75 jenjen75 commented Jun 30, 2023

Hello,

ofetch and all unjs package are really awesome !

So far, retry option allow number which retry fetch until the count is 0.
This PR allow to set retry with a function. It can be useful to handle programmatically or delay retries, it allow to implement any retry backoff algorithm.

@jenjen75 jenjen75 changed the title FEAT: Support retry function feat: Support retry function Jun 30, 2023
@jenjen75 jenjen75 changed the title feat: Support retry function feat: support retry function Jun 30, 2023
@codecov
Copy link

codecov bot commented Jul 1, 2023

Codecov Report

Merging #253 (543da56) into main (41c3b56) will decrease coverage by 0.55%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main     #253      +/-   ##
==========================================
- Coverage   90.47%   89.93%   -0.55%     
==========================================
  Files           5        5              
  Lines         462      467       +5     
  Branches       74       76       +2     
==========================================
+ Hits          418      420       +2     
- Misses         44       47       +3     
Impacted Files Coverage Δ
src/fetch.ts 93.49% <50.00%> (-1.11%) ⬇️

@zweeen
Copy link

zweeen commented Jul 19, 2023

@jenjen75 thank you very much for this feature can you improve your code to take into account the Codecov Report please.

@pi0
Copy link
Member

pi0 commented Aug 16, 2023

Hi dear @jenjen75 thanks so much for making this PR and sorry it took long to respond ❤️

I think with the addition of retryDelay in #262 and using interceptors it should be possible to conditionally/progreammatically have different behaviors.

I am little bit hesitated to introduce this feature because it adds little bit to the bundle size.

But i am happy to reopen and discuss if you think differently 👍🏼

@pi0 pi0 closed this Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants