Skip to content

Keep below the API rate limit#22

Open
phillip-hopper wants to merge 7 commits into
Ontraport:masterfrom
rvwholesalers:master
Open

Keep below the API rate limit#22
phillip-hopper wants to merge 7 commits into
Ontraport:masterfrom
rvwholesalers:master

Conversation

@phillip-hopper
Copy link
Copy Markdown

Added the option to not exceed the API rate limit of 180 requests per minute. If the number of API requests is approaching the limit, short pauses are taken to prevent the code from reaching the limit. A short sleep of 0.25 seconds is added when the count remaining gets below 10%. When the count gets down to less than 5% remaining, a 0.5 second sleep is inserted before the next call. Since the limit is 3 per second, this pause will effectively prevent the program from reaching the limit.

Having it set to 1 minute prevented it from receiving the 504 timeout from the server
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.

1 participant