Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
How to control request frequency when using Promise.all()

I need some data from another site, So i should request the site one by one, I put the in promises array and using Promise.all(promises) to do it fast.

But the problem is it is too fast, so the site server block me a while, How to control request frequency when using Promise.all()?

Following is my code:

(async() => {
  const request = require('request-promise')

  let promises = []
  let i = 10000
  while( i < 0){
    promises.push(new Promise(async(r) => {
      await request({
        uri: 'http://somehost_i_need_the_data/' + i
      })
      r()
    }))
    i++
  }

  await Promise.all(promises)

})()
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!