diff --git a/lib/dirty/dirty.js b/lib/dirty/dirty.js index df07f7d..7500e2d 100644 --- a/lib/dirty/dirty.js +++ b/lib/dirty/dirty.js @@ -94,6 +94,9 @@ Dirty.prototype.forEach = function(fn) { + + +// Called when a dirty connection is instantiated Dirty.prototype._load = function() { var self = this, buffer = '', length = 0; @@ -168,6 +171,7 @@ Dirty.prototype._load = function() { }); this._writeStream.on('drain', function() { + self._writeDrain(); }); }; diff --git a/test/node_v0.10.0.js b/test/node_v0.10.0.js index d77d390..3a438ed 100644 --- a/test/node_v0.10.0.js +++ b/test/node_v0.10.0.js @@ -35,21 +35,13 @@ else { describe('using the disk store', function() { it('should trigger the callback if provided', function(cb) { - connectToDiskDb(function (err, db) { - if (err) { - console.error("Could not connect to disk database!",err); - return cb(err); - } + connectToDiskDb(function (count, db) { setSample(db,cb); }); }); it('should trigger the callback for each of 10 db calls', function(cb) { - connectToDiskDb(function (err, db) { - if (err) { - console.error("Could not connect to disk database!",err); - return cb(err); - } + connectToDiskDb(function (count, db) { async.eachSeries(_.range(10),function (i,cb) { setSample(db, cb); }, cb);