-
Notifications
You must be signed in to change notification settings - Fork 143
Add rate limiting using Reddit RateLimit API response headers #71
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
base: master
Are you sure you want to change the base?
Conversation
replace handle .then with .complete
|
Note: this pull request doesn't update version information or anything, I will leave that up to @j0be to decide how to handle any versioning or repo maintenance. |
|
Nice addition! Cleaning up an account with a lot of comments takes a long time when it requires manual intervention in an alert dialog every time it does not respect the rate limit. |
|
This is awesome! I was about to try to implement something in this fashion, since I want to let this running while I am not around, and having to confirm on the confirm popup was getting on my way. I changed the one-line script to point to your branch and changes: Thanks @jfl88 |
| pd.actions.page.next(); | ||
| } | ||
| const timeout = pd.helpers.getRateLimitTimeout(xhr); | ||
| console.log('timeout: ' + timeout); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to suggest this to be changed to: console.debug so one can hide these log lines from the main console's output...
I took @braboobssiere's development and also applied it to the handle function as well.
With this change all functions (search, edit, delete) will look at the RateLimit feedback from Reddit API and use it to set the timeout function period. When the response from Reddit is 5 queries remaining or less, it will wait for the reset period to expire before executing again.