Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda