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

Too many calls to 'rate limit status' #40

Merged
merged 97 commits into from May 19, 2020

Conversation

stefanjwojcik
Copy link
Contributor

Hey Randy,

I noticed I introduced a bug on the my last PR. I noticed while using the Twitter package that it was making an excessive number of calls to the rate limit status endpoint. This logic of course was to prevent to many calls to the API, but the 'reconnect loop' would issue three calls to the rate limit endpoint per ANY call, which was way too much and causing errors.

To fix this, I created an API_INFO global to hold the status of all the endpoints and to subtract from that endpoint count object each time a call is made to a particular endpoint. That way, the program counts the remaining allocations for each endpoint without needing to call the rate limit endpoint. When it runs out of calls, it resets the count by calling the rate limit status endpoint. All tests pass.

@randyzwitch
Copy link
Owner

LGTM, but I haven't tested it locally. Happy to merge if you're asserting it works, otherwise it might be a few days before I can check this out

@stefanjwojcik
Copy link
Contributor Author

I just double-checked on a separate machine and it checks out. I think it's good to merge, changes are pretty minimal in this PR.

@randyzwitch randyzwitch merged commit 7a4fba9 into randyzwitch:master May 19, 2020
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.

None yet

2 participants