Making multiple calls to API at the same time

Getting a 429 means that you’re doing too many requests in a short time.
This is done in order to prevent abuse and to keep the server load under control: imagine if every app had unlimited access and tried to fetch as much data as possible, Atlassian’s server cost would skyrocket.

What you should do is limit the amount of concurrency, e.g. instead of making 20 calls at the same time make 3 at a time, that’s still better than fetching sequentially.
Moreover, when you get a 429 you also get information in the response headers about when you’ll be able to make further requests, check that header and act accordingly: don’t spam requests until one goes through or you may get even worse limits.

There are libraries and tools that can help you in most major languages, you can use p-map for example in Javascript, an ExecutorService with a fixed thread pool in Java…

1 Like