Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
Added support for node v0.12.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Feb 9, 2015
1 parent c39cc94 commit a478c1a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ docs
.DS_Store
coverage/

db/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ after_success:
- npm run publish-coverage
language: node_js
node_js:
- 0.12
- 0.10
services:
- rabbitmq
Expand Down
14 changes: 8 additions & 6 deletions lib/mongo_ascoltatore.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ var MongoAscoltatore = function(opts) {
this.connectionParams = {
capped: true,
size: this._opts.size || 10 * 1024 * 1024, // 10 MB
max: this._opts.max || 1000 // documents
max: this._opts.max || 10000 // documents
};

var that = this;
Expand Down Expand Up @@ -108,7 +108,7 @@ MongoAscoltatore.prototype.publish = function(topic, message, options, done) {
options: options
};

debug('publishing message: ' + message + ' on ' + topic + '...');
debug('publishing message', messageObj);

this.collection.insert(messageObj, { w: 1 }, done);
};
Expand Down Expand Up @@ -146,10 +146,12 @@ MongoAscoltatore.prototype._handle = function(die, callback) {
err = args.shift();

if (err && !that._closed) {
that.emit('error', err);
if (that._cursor && that._cursor.isClosed()) {
that._handleCursorClosed(that._lastSuccessfulHandling);
}
if (that._cursor && that._cursor.isClosed()) {
that._handleCursorClosed(that._lastSuccessfulHandling);
} else {
that.emit('error', err);
}
return;
}

if (err && die) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"sinon": "^1.10.3",
"sinon-chai": "^2.6.0",
"optimist": "~0.6.0",
"async_bench": "~0.3.0",
"async_bench": "~0.4.0",
"dox-foundation": "0.5.4",
"mosca": "git://github.com/mcollina/mosca.git",
"jshint": "~2.5.2",
Expand All @@ -72,6 +72,6 @@
"mqtt": "~1.0.0",
"mongodb": "~1.4.8",
"eventemitter2": "~0.4.14",
"qlobber-fsq": "~0.1.1"
"qlobber-fsq": "~0.3.0"
}
}
10 changes: 3 additions & 7 deletions test/mongo_ascoltatore_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ describeAscoltatore("mongo", function() {
var count = 0;
var max = 2000;

function doPub() {
async.setImmediate(function() {
that.instance.pub("hello/123", "abcde");
});
function doPub(n, next) {
that.instance.pub("hello/123", "abcde " + n, {}, next);
}

that.instance.sub("hello/*", function(topic, value) {
Expand All @@ -53,9 +51,7 @@ describeAscoltatore("mongo", function() {
done();
}
}, function() {
for (var i = 0; i < max; i++) {
doPub();
}
async.times(max, doPub);
});
});

Expand Down

0 comments on commit a478c1a

Please sign in to comment.