not-an-aardvark / snoowrap

A JavaScript wrapper for the reddit API
MIT License
1.01k stars 127 forks source link

How to avoid 429s #344

Open peebles opened 2 years ago

peebles commented 2 years ago

I am doing

r.config({ continueAfterRatelimitError: true, requestDelay: 1000, debug: true }); r.getSubmission(ID).expandReplies({depth: 5}).then(data => { ... }

and eventually hitting 429 exception, which I expected to avoid. I believe it might be due to either (1) your rate limiting code is not considering many concurrently scheduled fetches, or (2) it is calling "morechildren" more than one at a time, where the reddit doc says (for morechildren): "NOTE: you may only make one request at a time to this API endpoint. Higher concurrency will result in an error being returned.", and maybe that is returning 429.

Or ... am I missing something here? I never want to take a 429 exception, no matter how long my script runs! How?

peebles commented 2 years ago

By the way, the submission id in question is "ohhg9t" if you want a test case.