Question
Pravin Barton · Jun 14, 2021

How to deal with rate limiting in a Business Operation

I'm working with a REST API that will sometimes rate limit our requests by returning an HTTP 429 Too Many Requests status code. Is there a good way in a business operation to handle this by throttling our requests until we get a success response? My initial thoughts are:

  • Reduce the pool size on the business operation to 1 so all requests are first in, first out.
  • If the API returns a 429 response, set %rate = $get(%rate,1)*2, then hang %rate, then send the request to the back of the queue.
  • If the API returns a success response, kill %rate

I'm wondering if there's a better way to do this. Particularly if this is possible without limiting the business operation to run in a single process.

Product version: IRIS 2020.1
0
0 108
Discussion (1)1
Log in or sign up to continue

It seems like this approach would still work with a poolsize > 1. Of course each worker job will decide on its own if it should throttle or not.