Skip to content

Commit

Permalink
Fixes to make all the tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
christkv committed Nov 7, 2011
1 parent 1bfca3d commit 0241cad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 2 additions & 8 deletions lib/mongodb/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,12 @@ var Db = exports.Db = function(databaseName, serverConfig, options) {
var reaper = function(dbInstance, timeout) {
return function() {
// console.log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! reaper running")
// Only trigger reaper if it's still valid
// Only trigger reaper if it's still valid and we have a proper connection pool
if(dbInstance.reaperIntervalId != null) {
// console.dir(dbInstance._mongodbHandlers)
// console.log(dbInstance.serverConfig.isConnected())
// console.log(dbInstance.reaperIntervalId)
// console.log(dbInstance.tag)

// Current time
var currentTime = new Date().getTime();

// If it's no longer connected clear out the interval
if(!dbInstance.serverConfig.isConnected() && dbInstance.reaperIntervalId != null) {
if(dbInstance.serverConfig.connectionPool != null && !dbInstance.serverConfig.isConnected() && dbInstance.reaperIntervalId != null) {
// Clear the interval
clearInterval(dbInstance.reaperIntervalId);
// this._mongodbHandlers = {_mongodbCallbacks : {}, _notReplied : {}};
Expand Down
8 changes: 5 additions & 3 deletions test/auxilliary/authentication_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ var tests = testCase({
db1.collection('stuff', function(err, collection) {

collection.find().toArray(function(err, items) {
test.done();
test.ok(err == null);
test.equal(1, items.length);

Expand Down Expand Up @@ -174,8 +173,7 @@ var tests = testCase({
},

function logoutDb2(err, result) {
test.ok(err != null);

test.ok(err != null);
db2.logout(this);
},

Expand All @@ -185,6 +183,10 @@ var tests = testCase({
collection.insert({a:2}, {safe:true}, function(err, result) {
test.ok(err != null);
test.done();
// Close all connections
db1.close();
db2.close();
admin.close();
});
});
}
Expand Down
3 changes: 3 additions & 0 deletions test/tools/server_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ ServerManager.prototype.start = function(killall, callback) {
// Create start command
var startCmd = generateStartCmd({log_path: self.log_path,
db_path: self.db_path, port: self.port, durable: self.durable, auth:self.auth});

// console.log("----------------------------------------------------------------------- start")
// console.log(startCmd)

exec(killall ? 'killall mongod' : '', function(err, stdout, stderr) {
if(self.purgedirectories) {
Expand Down

0 comments on commit 0241cad

Please sign in to comment.