Comparing version 0.1.1 to 0.1.2
@@ -21,2 +21,3 @@ /* | ||
, assert = require('assert') | ||
, nop = function() {} | ||
@@ -58,2 +59,4 @@ function MQEmitter(opts) { | ||
cb = cb || nop | ||
if (this.concurrency > 0 && this.current >= this.concurrency) { | ||
@@ -80,2 +83,3 @@ | ||
if (!message) { | ||
// we are at the end of the queue | ||
this.current-- | ||
@@ -95,2 +99,3 @@ } else { | ||
if (matches.length === 0) { | ||
callback() | ||
return this._next(receiver) | ||
@@ -126,5 +131,3 @@ } | ||
if (that.num === 0) { | ||
if (that.callback) { | ||
that.callback() | ||
} | ||
that.callback() | ||
mq._next(that) | ||
@@ -131,0 +134,0 @@ } |
{ | ||
"name": "mqemitter", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "An Opinionated Message Queue with an emitter-style API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
13
test.js
@@ -197,1 +197,14 @@ | ||
}) | ||
test('without any listeners and a callback', function(t) { | ||
var e = mq() | ||
, expected = { | ||
topic: 'hello world' | ||
, payload: { my: 'message' } | ||
} | ||
e.emit(expected, function() { | ||
t.equal(e.current, 1, 'there 1 message that is being processed') | ||
t.end() | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
431350
269