Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
How to deal with timeouts when querying database with NodeJS?

I have a function that returns a promise.

this.getDataFromMainDB()
    .then()
    .catch();

This function gets more than 300.000 records from the main DB and stores it on the microservice DB, so that it can do its job.

It uses an AsyncGenerator (with 1.000 limit), KnexJS to connect to SQL Server.

Now, timeouts occur during this query and it stops.

I thought of using another function on that catch that would take the last ID recorded in the microservice DB and restart the query from than on.

My question is:

  • This approach would generate many concurrent processes, restarting this query in parallel each time a timeout occurs;

OR

  • The process is always the same, it would always be the same process restarting on timeouts, until it finishes the gathering of data?
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda