not-an-aardvark / snoowrap

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

Questions on Rate limits #301

Closed rosgoo closed 3 years ago

rosgoo commented 3 years ago

Hi, I have two questions on snoowrap rate limits:

  1. I have the following config client.config({ requestDelay: 1500 }); and yet keep on hitting the Reddit API rate limit. I wonder if this has to do with too many concurrent snowwrap requests from logged-out users but any help would be appreciated!
  2. What is the behavior of turning continueAfterRatelimitError to true? Will the snoowrap request promise just hang until the request can be completed (once the rate limit period resets) or will it return immediately and snoowrap will fire another request internally for the request that hit the rate limit error?
Venefilyn commented 3 years ago

Hi!

  1. Not sure what you mean by logged-out users, you mean using Snoowrap to make requests unauthenticated? That has an incredibly low rate limit. So if you're doing this it's best if you do requests server-side and cache as much as you can. If you're using Snoowrap in a browser then each rate limit is per browser
  2. With it true, it will wait until it can fire of another request. Snoowrap can either trigger an error on rate limit or sleep until it can fire of another request
rosgoo commented 3 years ago

Hey! Thanks for your quick reply! That's helpful.