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

Smarter Throttle Gate #839

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Smarter Throttle Gate #839

merged 3 commits into from
Dec 2, 2020

Conversation

tanema
Copy link
Contributor

@tanema tanema commented Nov 18, 2020

related #801

This changes our rate limiter into a smart circuit breaking throttle gate. What this means functionally that:

  • The request rate is limited to 4 per/second with bursts of 4 requests allowed
  • When we get a 429 response, we cancel all inflight requests and they are all paused for the Retry-After value
  • the allotted time is waited on
  • The cancelled requests are started again
  • The original request with the 429 response is restarted.
  • None of these retries are counted against the http retry mechanism as they are not an error response from shopify or an error in the asset.

Todo

Tests still need to be updated a little bit.

Warn Checklist

  • This changes the interface and requires a Major/Minor version change.
  • I have 🎩'd these changes by using the commands I changed by hand.
  • I have added a dependancy to the project.
  • I have considered any potential impact on node-themekit

@andyw8
Copy link
Contributor

andyw8 commented Nov 18, 2020

None of these retries are not counted

Should that say "None of these retries are counted"?

@andyw8
Copy link
Contributor

andyw8 commented Nov 18, 2020

The request rate is limited to 4 per/second with bursts of 4 requests allowed

I think that's only for Plus, standard is 2 per second: https://shopify.dev/concepts/about-apis/rate-limits#rate-limiting-methods

@tanema
Copy link
Contributor Author

tanema commented Nov 18, 2020

I am referring to themekit and not shopify. Since themekit doesnt really have a way to know what the merchant is, I have set it to the larger limit, and rely on the throttling to handle it. Since the range is not the different, non-plus people will not notice the difference.

@tanema tanema mentioned this pull request Nov 20, 2020
4 tasks
@tanema tanema force-pushed the smarter_request_throttle branch from a38a58b to 64009da Compare December 2, 2020 16:45
@tanema tanema merged commit 2fdafdb into master Dec 2, 2020
@tanema tanema deleted the smarter_request_throttle branch December 2, 2020 16:52
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.

2 participants