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

[sitecore-jss] Retry policy to handle transient network errors #1731

Merged
merged 12 commits into from
Feb 9, 2024

Conversation

addy-pathania
Copy link
Contributor

@addy-pathania addy-pathania commented Feb 9, 2024

Adds better retry handling approach on top of exiting:

  • User can pass retryStrategy to configure custom retry config to the services. They can customize the error codes and the number of retries. It consist of two functions shouldRetry and getDelay

  • If retryStrategy is not passed then defaultRetryStrategy will be used. The defaultStrategy handles 429 and the 500 error codes e.g. 502, 503, 504, 520, 521, 522, 523, 524.

  • getDalay calculates the delay (in milliseconds) before the next retry based on the given error, attempt count and exponential factor which defaults to 2.

  • This PR follows the Contribution Guide

  • Changelog updated

Description / Motivation

Testing Details

  • Unit Test Added
  • Manual Test/Other (Please elaborate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@addy-pathania addy-pathania requested a review from a team February 9, 2024 13:19
packages/sitecore-jss/package.json Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.test.ts Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.test.ts Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.ts Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.ts Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.ts Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.ts Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@ambrauer ambrauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some doc comments to touch up / add, otherwise approved. 👍

packages/sitecore-jss/src/graphql-request-client.ts Outdated Show resolved Hide resolved
packages/sitecore-jss/src/graphql-request-client.ts Outdated Show resolved Hide resolved
addy-pathania and others added 5 commits February 9, 2024 13:56
Co-authored-by: Adam Brauer <400763+ambrauer@users.noreply.github.com>
Co-authored-by: Adam Brauer <400763+ambrauer@users.noreply.github.com>
@ambrauer ambrauer merged commit 0840137 into dev Feb 9, 2024
1 check was pending
@ambrauer ambrauer deleted the feature/jss-1594-retry-policy branch February 9, 2024 19:34
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

Successfully merging this pull request may close these issues.

3 participants