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

Request Retries #5

Open
fdemir opened this issue Dec 20, 2022 · 0 comments
Open

Request Retries #5

fdemir opened this issue Dec 20, 2022 · 0 comments

Comments

@fdemir
Copy link

fdemir commented Dec 20, 2022

Is your feature request related to a problem? Please describe.
The fetchp does not allow users to retry failed requests, which can cause problems with data transfers. Adding a request retry feature would make transfers more reliable and successful.

Describe the solution you'd like
The retry property in the FetchpRequestInit interface allows users to specify whether or not to retry failed requests, and how many times to retry them. It can be set to a boolean value, a number, or a custom function that determines whether or not to retry a request based on the error that occurred.

  • If retry is set to true, the fetchp will automatically retry failed requests once.
  • If retry is set to a number, the fetchp will automatically retry failed requests that number of times.
  • If retry is set to a custom function, the fetchp will pass the error that occurred to the function, and will only retry the request if the function returns true.

Additional context
The retryDelay function calculates the time to wait before retrying based on the attemptIndex, which starts at 0 for the first attempt. It can be used to increase the delay with each retry attempt to prevent overwhelming the server.

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

No branches or pull requests

1 participant