Skip to content

Commit

Permalink
Changed waitForConnection to use setTimeout instead of nextTick, shou…
Browse files Browse the repository at this point in the history
…ld lower cpu contention
  • Loading branch information
christkv committed Sep 22, 2011
1 parent a7b5556 commit e7bb1ec
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/mongodb/connection.js
Expand Up @@ -187,12 +187,14 @@ var setupConnectionPool = function(self, poolSize, reconnect) {
self.emit("reconnect");
}
} else {
process.nextTick(waitForConnections);
// process.nextTick(waitForConnections);
setTimeout(waitForConnections, 100);
}
}

// Wait until we are done connected to all pool entries before emitting connect signal
process.nextTick(waitForConnections);
// process.nextTick(waitForConnections);
setTimeout(waitForConnections, 100);

// Return the pool
return connectionPool;
Expand Down

0 comments on commit e7bb1ec

Please sign in to comment.