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

retryOn should still honour the number of retries #94

Open
AlexBroadbent opened this issue Dec 12, 2024 · 0 comments
Open

retryOn should still honour the number of retries #94

AlexBroadbent opened this issue Dec 12, 2024 · 0 comments

Comments

@AlexBroadbent
Copy link

In the Example: Retry custom behavior code snippet from the readme, it would be assumed that also passing in a retries: 3 would mean that there would be at-most 3 attempts of the function. However, it would appear that's not the case as I found from running this setup:

fetchWithRetry(globalThis.fetch, { 
  retries: 3,
  retryDelay: 1000,
  retryOn(
    attempt: number,
    error: Error | null,
    response: Response | null,
  ): boolean {
    return error !== null || (response?.status && (response.status === 412 || response.status >= 500));
  }
});

It's only after coming back to the docs and seeing the Example: Retry custom behaviour with async example which has an if check on the attempt number that I realised the initial retries property is then overridden by retryOn.

convex-copybara bot pushed a commit to get-convex/convex-backend that referenced this issue Jan 16, 2025
This fixes the following:
* When we exceeded the max retries, we'd actually just keep retrying forever because `retryOn` overrode the `retries: 6` (see jonbern/fetch-retry#94)
* We have a fair amount of back off and no progress messages, so it appears like the CLI is just hanging even when it's still potentially making progress. I made it print quiet messages starting on the third retry so the CLI doesn't seem completely dead.

GitOrigin-RevId: 34db98eabc9e2df89b2569f6a07f8aaba41a6c72
convex-copybara bot pushed a commit to get-convex/convex-js that referenced this issue Jan 16, 2025
This fixes the following:
* When we exceeded the max retries, we'd actually just keep retrying forever because `retryOn` overrode the `retries: 6` (see jonbern/fetch-retry#94)
* We have a fair amount of back off and no progress messages, so it appears like the CLI is just hanging even when it's still potentially making progress. I made it print quiet messages starting on the third retry so the CLI doesn't seem completely dead.

GitOrigin-RevId: 34db98eabc9e2df89b2569f6a07f8aaba41a6c72
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