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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃挕Can you add retry config to your amazing work? #23

Open
jechaviz opened this issue Apr 25, 2022 · 0 comments
Open

馃挕Can you add retry config to your amazing work? #23

jechaviz opened this issue Apr 25, 2022 · 0 comments

Comments

@jechaviz
Copy link

Just like this (maybe like your awesome fluent api)
In this project: https://github.com/JustinBeckwith/retry-axios
and add methods like get, put, and so on doing their job.
source: https://github.com/JustinBeckwith/retry-axios
`raxConfig: {
// Retry 3 times on requests that return a response (500, etc) before giving up. Defaults to 3.
retry: 3,

// Retry twice on errors that don't return a response (ENOTFOUND, ETIMEDOUT, etc).
noResponseRetries: 2,

// Milliseconds to delay at first.  Defaults to 100. Only considered when backoffType is 'static'
retryDelay: 100,

// HTTP methods to automatically retry.  Defaults to:
// ['GET', 'HEAD', 'OPTIONS', 'DELETE', 'PUT']
httpMethodsToRetry: ['GET', 'HEAD', 'OPTIONS', 'DELETE', 'PUT'],

// The response status codes to retry.  Supports a double
// array with a list of ranges.  Defaults to:
// [[100, 199], [429, 429], [500, 599]]
statusCodesToRetry: [[100, 199], [429, 429], [500, 599]],

// If you are using a non static instance of Axios you need
// to pass that instance here (const ax = axios.create())
instance: ax,

// You can set the backoff type.
// options are 'exponential' (default), 'static' or 'linear'
backoffType: 'exponential',

// You can detect when a retry is happening, and figure out how many
// retry attempts have been made
onRetryAttempt: err => {
  const cfg = rax.getConfig(err);
  console.log(`Retry attempt #${cfg.currentRetryAttempt}`);
}

}`

Also there's another that has it's magic hidden like this:
https://github.com/softonic/axios-retry

Thanks in advance beacuse your awesome work

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