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

[BUG] onRetry() called too many times #15

Open
rpaterson opened this issue Jan 13, 2020 · 0 comments
Open

[BUG] onRetry() called too many times #15

rpaterson opened this issue Jan 13, 2020 · 0 comments

Comments

@rpaterson
Copy link

What / Why

The onRetry callback is documented as "called whenever a retry is attempted", but in practice it appears to be called whenever a retry is attemptable. It is called even when no retry is attempted!

When

  • n/a

Where

  • n/a

How

Current Behavior

onRetry is called whenever retrying a response is attemptable, meaning it's not a POST and status code is 408, 420, 429, or >= 500. It is called even if retrying is completely disabled, or all the retries have been exhausted.

Steps to Reproduce

// should not print "we will retry!" but it does
fetch('https://httpstat.us/500', {
  retry: false,
  onRetry() {
    console.log('we will retry!')
  }
});

// should print "we will retry!" two times but prints it three times
fetch('https://httpstat.us/500', {
  retry: 2,
  onRetry() {
    console.log('we will retry!')
  }
});

Expected Behavior

onRetry should be called only if another request will actually happen, taking in to account the limit on the number of retries.

Who

  • n/a

References

  • n/a
@isaacs isaacs added the bug label Jun 1, 2021
@settings settings bot removed the bug label Sep 21, 2021
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

3 participants
@isaacs @rpaterson and others