autoLimit should actually check Shopify response and wait to retry
See original GitHub issueHi,
We’re looking at switching to this library instead of https://github.com/christophergregory/shopify-node-api
There’s an issue with autoLimit. The other library accepted a limit and it automatically checks Shopify’s response with the remaining limit, and waits until it retries again. Simply said, it just works, we never had to worry about limits. Some calls will take longer to return.
Here we tried
autoLimit: { calls: 1, interval: 1000, bucketSize: 16 },
according to https://github.com/MONEI/Shopify-api-node/issues/135
and it still gives error
"statusCode": 429,
"statusMessage": "Too Many Requests",
after ~10 seconds.
We can see the Shopify limit decreasing with .on('callLimits')
, but the library seems to ignore it.
Could it check that and wait automatically?
Checking it would also help if having multiple instances making simultaneous calls. Since the current limit is always returned by Shopify, no need to worry what limits to set in each case.
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Also - the Retry-after header exists for the same purpose - from Shopify’s docs: https://help.shopify.com/en/api/reference/rest-admin-api-rate-limits
@lpinca - ‘just use a queue’ - erm we have a hint from the server on both the response code and the headers. Why is it
wrong
? it’s definitely something I’m willing to implement - as it’s much easier than the answer of: change your whole architecture Serverless? tough luck - make it a queue somehow… that somehow takes into account the time…