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

Stalls on third attempt #174

Open
elie222 opened this issue Oct 26, 2021 · 1 comment
Open

Stalls on third attempt #174

elie222 opened this issue Oct 26, 2021 · 1 comment

Comments

@elie222
Copy link

elie222 commented Oct 26, 2021

This is our config:

const axiosInstance = axios.create({
  headers: {
    'Content-Type': 'application/json',
    Accept: 'application/json',
  },
})
axiosInstance.defaults.raxConfig = {
  retry: 3,
  instance: axiosInstance,
  onRetryAttempt: evt => {
    console.log(`onRetryAttempt. attempt #${evt.config!.raxConfig?.currentRetryAttempt}`)
  },
}
const interceptorId = rax.attach(axiosInstance)

After printing onRetryAttempt. attempt #2 it just stops altogether. I would have thought it would error and we could continue on from there but it just halts everything.

Are we doing something wrong?

@daneren2005
Copy link

I am seeing the same thing. I am using my own custom shouldRetry handler to get around this. If you add

shouldRetry: (error) => {
  const cfg = rax.getConfig(error);
  console.log(cfg);

  return return rax.shouldRetryRequest(error);
}

you will see that on the second run the httpMethodsToRetry and statusCodesToRetry properties are empty arrays. I'm assuming that internally they are relying on this same code, so an empty array for both of those means that it is just ignoring everything and only retrying a single time instead of the 3 times you configured it to run for.

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

2 participants