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

145
Vistas
Improving performance in a Nest JS service

I developed a service with Nest JS which calls a third party api in order to get the status related to some pull requests in Azure DevOps. The logic works as follows: I provide an array with links to a function, then I use a for loop to a block of code which will take care of getting the url from the array and build the http request and call the api to retrieve the status(using the axios implementation in Nest JS). It works as an async operation which sequentially makes each request. But it is taking relatively too long(about 160s to get 1000 requests). Does someone have a suggestion in how to improve the speed of execution?

async getAzureStatus(urlAdjusted) {
        const updatedPRStatus = [process.env.EXCEL_COLUMN_PR_STATUS_HEADER];
        
        for(let counter = 1; counter < urlAdjusted.length; counter++) {
            if( urlAdjusted[counter] == 'Not needed')
            {
                updatedPRStatus.push('Not needed');
            }
            else
            {
                const config =
                {
                    headers:
                    {
                        Authorization: process.env.AUTHENTICATION_KEY,
                    },
                };
                try 
                {
                    const response = await lastValueFrom(this.httpService.get(urlAdjusted[counter], config));
                    updatedPRStatus.push(response.data['status']);
                } catch(error) 
                {
                    console.log('error retrieving pr number ' + counter );
                    updatedPRStatus.push('Could not get any data');
                }
            } 
        }
        
        return updatedPRStatus;
    }
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