Rate limiting promises

You have a bunch of requests to make and you want to do them in the most efficient way possible.
Unfortunately your api is rate limited.
This lets you define a cool down period after a batch is sent.

Example:
100 requests to make
5 per second rate limit
20 batches each with a 5 second cool down period

1. create a promise for each batch
2. resolve that promise once the models xhr were executed and returned their own promises
3. repeat until all batches are done
4. return array of all the promises generated by the xhrs

Leave a Reply

Your email address will not be published. Required fields are marked *