-
Notifications
You must be signed in to change notification settings - Fork 37
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
sleep on requests limit reach issue #15
Comments
I totally agree with to you. The api limit check is still not optimized |
Do you have any idea to deal with this problem? @Art3miX |
I didn't use this lib in the end and can't do a pull request. But yea, its pretty easy to change it. in client.php : callLimitReached should return true if 1 or less requests left (just in case we leave extra 1 request in bucket). And the sleep should be changed to 1 second, because shopify give us 2 requests each second, so we wait 1 second and we get extra 2 requests, this will ensure us we only wait the minimum time needed between requests.
Sorry for this poor answer, but this should get you going (unless i forgot something), i'm sure someone can find the time to do a pull request. |
Ok. I think it's great idea. But how can I do it inside this lib without processing in the request method? |
I found a solve in the internet by reading header named Retry-After, but I don't test it. |
Hey, trying to understand why you did it this way, i didn't test it yet, but it doesn't seems right
It seems like worse case you will wait 10 seconds to make a request while you still have 8 requests available left, best case is 3 seconds.
You are doing the limit check after each request, so why don't you just check if you have 1 available request left, if you do sleep for 1 second?
Anything i'm missing why this was built this way?
The text was updated successfully, but these errors were encountered: