0

My react application has to call an api server 100 times. But I don't want to send hundred requests at once. I want to send only 10 at once. I have looked at bounce and throttle. They are all time based, is there any library that throttles based on number of promises requested and resolved?

AndrewL64
  • 15,794
  • 8
  • 47
  • 79
Ravi
  • 1,811
  • 1
  • 18
  • 31
  • 3
    What do you want to accomplish? Make 10 requests, wait for a while, and then 10 more, until your reach 100? Could you include the code you have written so far in your question? – Tholle Jul 07 '18 at 11:57
  • afaik, the browser should already be doing this for you - https://stackoverflow.com/a/30064610/4722144 – Raghudevan Shankar Jul 07 '18 at 12:08
  • Right now, I'm just calling the api. I haven't written a code for throtling. But that is my last option. If there is an existing library, I want to use it instead of re inventing the wheel – Ravi Jul 07 '18 at 13:09
  • @RaghudevanShankar thanks. looks like the browser already takes care of this. But one place where this would not work is, I want to limit to say 5 connections. Because the api calls a teradata db with the credentials I passed and TD has a cap of 5 connections. Is there a way to set the max connections in browser from react js? – Ravi Jul 07 '18 at 13:12

0 Answers0