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

87
Vistas
more efficient way of looping await / async?

I am trying to get messages given a list of message ids (Gmail API).

let messageIdList = [msg1: { id: 1234 }, ...]
 
let messages = [];

for (const msg of messageIdList) {
    const response = await gapi.client.gmail.users.messages.get({
        'userId': 'me',
        'id': msg.id,
        'format': 'full'
    })

    messages.push(response.result);
};

// do something with messages

I used a for … of loop because of this post, so it works...but it's super slow (I assume it's because it goes one at a time). What would be a way to go about making all of the API calls be fired at the same time but somehow knowing when all of them are complete?

about 4 years ago · Juan Pablo Isaza
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