-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: client no longer delays when it wont retry #51
Conversation
@@ -360,7 +360,7 @@ function retry(fn, ctx) { | |||
function attempt(i) { | |||
return fn(ctx) | |||
.catch((err) => { | |||
if (maxAttempts > 0) { | |||
if (i < maxAttempts && isCriticalError(err) && ctx.retryDelay && ctx.retryDelay > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder whether it's worth leaving a comment explaining the rationale here? Perhaps even something as simple as (just so that you can take a quick glance at the code and understand what it does straight away):
// Only critical errors should retry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah agree with this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: critical errors. In this instance isn't it clear from the code that that's the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cjewell47 there are a lot of other conditions chained in the if statement, but none of them matter unless the error is critical (which I think is the main fix/change in this PR). The comment would just highlight that importance, so that someone new to the code takes note 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks guys, we have added some jsdoc to make this a bit clearer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great spot - lgtm. I guess on Monday / whenever this goes through and gets bumped, we should remove all empty category forms in iSite just so:
- we prove that this fixes things
- there are only category forms in iSite that are actually being used
Can we please have some tests added for this |
Description
In the retry function, delay was firing without hitting retry, resulting in increased response times. We modified the function to only delay when the retry occurs.
Motivation and Context
Jira ticket
Types of changes
Checklist: