Skip to content

Fix/execute with retry wrapper exec #479

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

Closed
wants to merge 41 commits into from

Conversation

joshLong145
Copy link

@joshLong145 joshLong145 commented May 24, 2024

Description

Removes executeWithRetry as we no longer need to retry operations due to network stability fixes. We now will only retry operations which are critical to the standup of the sdk. The included node endpoints which are eligible for retry at this time are:

  • /handshake

Status codes we will retry on:

  • 408
  • 502
  • 503
  • 504

Introduces a new package fetch-retry which now handles retry logic for single requests. As we no longer need to group requests and retry as single network operation.

Type of change

  • 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 not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tested with local testing to force endpoint failure to observe retry.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@joshLong145 joshLong145 changed the base branch from master to staging/v6 May 24, 2024 19:49
import Ajv, { JSONSchemaType } from 'ajv';
//@ts-ignore no tyoe df
import fetchRetry from 'fetch-retry';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm I'm worried how browser (react, vite, parcel, etc.) would react to this dependency, I'll give it a spin next week

Copy link
Author

@joshLong145 joshLong145 May 25, 2024

Choose a reason for hiding this comment

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

its bundle is 'umd' format and does not attempt to redefine 'fetch' globally. I think it's okay but I'll publish a testing build with it for us to test with more before committing to it.

@joshLong145 joshLong145 marked this pull request as draft May 28, 2024 14:51
@joshLong145 joshLong145 marked this pull request as ready for review May 30, 2024 22:46
@MaximusHaximus MaximusHaximus force-pushed the fix/execute-with-retry-wrapper-exec branch from ad190c1 to c6a3768 Compare May 31, 2024 21:05
…-nodejs`. Fix return type on `sendRequest`; it doesn't return a Response. Throw in promise chain instead of creating extra rejected promises
@MaximusHaximus MaximusHaximus force-pushed the fix/execute-with-retry-wrapper-exec branch from c6a3768 to f168848 Compare May 31, 2024 21:08
Copy link
Author

@joshLong145 joshLong145 left a comment

Choose a reason for hiding this comment

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

Looks good. Left one comment. Have we done a browser test? once we do then I think we are good to merge it.

// error: Error | null,
// response: Response | null
) {
return Math.random() * (Math.pow(2, attempt) * interval);
Copy link
Author

Choose a reason for hiding this comment

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

Is this truly exponential? since we are multiplying by a random value couldn't we end up with a lower interval?

…Protocol/js-sdk into fix/execute-with-retry-wrapper-exec
@joshLong145 joshLong145 marked this pull request as draft June 3, 2024 14:25
@joshLong145
Copy link
Author

Screenshot 2024-06-03 at 10 21 10 AM
After doing some testing in browser environments it looks like the umd bundle target is non compatible with our build pipeline. Going to make a task in the current sprint to upgrade fetch-retry to a modern cross target bundling implementation. Once complete this pr can be merged.

Base automatically changed from staging/v6 to master June 3, 2024 16:44
joshLong145 pushed a commit that referenced this pull request Jun 5, 2024
@joshLong145
Copy link
Author

Closing for #497

@joshLong145 joshLong145 closed this Jun 5, 2024
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