Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9054065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:35:18+00:00 2026-06-16T13:35:18+00:00

I am trying to write a node.js application, and we need to deploy it

  • 0

I am trying to write a node.js application, and we need to deploy it in production.

We need to make sure that node.js does not hang when there are any long running processes/operations, like querying, or the database server access.

So, i am trying to make a call to mongo or to filesystem which takes very long time to finish, so that i can verify that other node.js server is free to serve any other requests while that takes place.

Sadly, i am not able to insert a record for which mongo takes really long time to finish or to make a synch call to the file system.

Can someone tell me how to do it?

Thanks

Tuco

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:35:19+00:00Added an answer on June 16, 2026 at 1:35 pm

    The trick is do a console log of the data after the block that do a call and a console.log in the callback if in the console apears first the message is actually asynchronous

    Im using mongojs as driver for mongo:

    collection.find({}, function(err, res) {
        console.log("done")
    });
    console.log("sendign signal")
    

    If its asynchronous, in the console:

    sendign signal
    done! 
    

    Now for the chained behavior you can make something like that

    dbChain = (function() {
      var chain = [], cursor = 0, busy = false;
    
      chainin = {
        push : function(aFn) {
          if(!busy) {
            chainin.reset();
            aFn();
            busy = true;
          } else {
            chain.push(aFn)
          }
        },
    
        next : function() {
          cursor++;
          if(chain[cursor]) {
            chain[cursor]();
          } else {
            chainin.reset();
          }
    
        },
    
        reset : function() {
          chain = [];
          cursor = 0;
          busy = false;
        }
      }
    
      return chainin;
    
    })()
    

    and, in all the db calls you have to do:

    dbChain.push(...(a function ) ...)
    

    in all your callbacks

    dbChain.next()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a Ruby script that interacts with a Node.js REPL. When
I am trying to write a small application that wraps some functions inside of
I'm trying to write an event handler that fires every time a node in
I'm trying to write a subroutine in Perl that will delete a given node
I am trying to write a node application which serves crjavascript code to a
I am trying to write server side for my web application using Node.js. The
I'm trying to write a Node.js module, using C++, that wraps and exposes some
I was trying to write a function that deletes a node from the linked
I'm trying to write a basic chat application with Node.js (Express), and Socket.io. Everything
I m trying write code that after reset set up rrpmax as 3000. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.