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

138
Views
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
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!