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

Add retry option for glue and fallback downloading methods #4148

Merged
merged 3 commits into from
Mar 23, 2022

Conversation

zishiwu123
Copy link
Contributor

@willeastcott
Copy link
Contributor

What about this line:

prepareWorkerModules(config, (err, clientConfig) => {

@zishiwu123
Copy link
Contributor Author

zishiwu123 commented Mar 22, 2022

What about this line:

prepareWorkerModules(config, (err, clientConfig) => {

Good point. However the basisInitialize() function that calls prepareWorkerModules() currently does not have a maxRetries parameter. We could create a maxRetries parameter with a default value in basisInitialize() like this example:

enableRetry(maxRetries = 5) {

But I'm not sure if:

  • a) that's the right way to go?
  • b) what the default value would be?

@willeastcott
Copy link
Contributor

Possibly. @slimbuck - what do you think?

@willeastcott
Copy link
Contributor

I'd suggest making maxRetries a property of the config object passed into basisInitialize (defaulting to 5 maybe?). But yeah, I'll leave it to @slimbuck to provide some thoughts...

@slimbuck
Copy link
Member

I'd suggest making maxRetries a property of the config object passed into basisInitialize (defaulting to 5 maybe?). But yeah, I'll leave it to @slimbuck to provide some thoughts...

I agree. We want maxRetries added to the basis config. In prepareWorkerModules, if maxRetries is missing, default to 5.

@slimbuck
Copy link
Member

Thanks for this @zishiwu123 it's awesome!

src/resources/basis.js Outdated Show resolved Hide resolved
src/resources/basis.js Outdated Show resolved Hide resolved
Thanks to @slimbuck for pointing out that 0 is a valid value for
config.maxRetries but (config.maxRetries || defaultMaxRetries)
would evaluate to false and use default value instead of 0.
@zishiwu123
Copy link
Contributor Author

zishiwu123 commented Mar 23, 2022

@slimbuck Good catch pointing out that config.maxRetries = 0 is a valid value but the expression (config.maxRetries || defaultMaxRetries) would have evaluated to false and used defaultMaxRetries when it shouldn't have. You should be included as a co-author in this PR.

Copy link
Member

@slimbuck slimbuck left a comment

Choose a reason for hiding this comment

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

🥳 nice one!

@willeastcott willeastcott merged commit d09ba63 into playcanvas:main Mar 23, 2022
@willeastcott
Copy link
Contributor

Seconded. 😄 Thanks for the contribution @zishiwu123!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Basis glue and fallback downloading methods aren't retrying
3 participants