mqemitter-redis
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -9,2 +9,3 @@ 'use strict' | ||
var msgpack = require('msgpack-lite') | ||
var EE = require('events').EventEmitter | ||
@@ -29,2 +30,4 @@ function MQEmitterRedis (opts) { | ||
this.state = new EE() | ||
var that = this | ||
@@ -48,2 +51,18 @@ | ||
this.subConn.on('connect', function () { | ||
that.state.emit('subConnect') | ||
}) | ||
this.subConn.on('error', function (err) { | ||
that.state.emit('error', err) | ||
}) | ||
this.pubConn.on('connect', function () { | ||
that.state.emit('pubConnect') | ||
}) | ||
this.pubConn.on('error', function (err) { | ||
that.state.emit('error', err) | ||
}) | ||
MQEmitter.call(this, opts) | ||
@@ -50,0 +69,0 @@ } |
{ | ||
"name": "mqemitter-redis", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Redis-based MQEmitter", | ||
@@ -8,4 +8,4 @@ "main": "mqemitter-redis.js", | ||
"inherits": "^2.0.1", | ||
"ioredis": "^2.5.0", | ||
"lru-cache": "^4.0.0", | ||
"ioredis": "^3.0.0", | ||
"lru-cache": "^4.1.1", | ||
"mqemitter": "^2.0.0", | ||
@@ -18,3 +18,3 @@ "msgpack-lite": "^0.1.14", | ||
"pre-commit": "^1.0.7", | ||
"standard": "^10.0.0", | ||
"standard": "^10.0.2", | ||
"tape": "^4.0.0" | ||
@@ -21,0 +21,0 @@ }, |
38
test.js
@@ -29,1 +29,39 @@ 'use strict' | ||
}) | ||
test('ioredis connect event', function (t) { | ||
var e = redis() | ||
var subConnectEventReceived = false | ||
var pubConnectEventReceived = false | ||
e.state.on('pubConnect', function () { | ||
pubConnectEventReceived = true | ||
newConnectionEvent() | ||
}) | ||
e.state.on('subConnect', function () { | ||
subConnectEventReceived = true | ||
newConnectionEvent() | ||
}) | ||
function newConnectionEvent () { | ||
if (subConnectEventReceived && pubConnectEventReceived) { | ||
e.close(function () { | ||
t.end() | ||
}) | ||
} | ||
} | ||
}) | ||
test('ioredis error event', function (t) { | ||
var e = redis({host: '127'}) | ||
t.plan(1) | ||
e.state.once('error', function (err) { | ||
t.deepEqual(err.message.substr(0, 7), 'connect') | ||
e.close(function () { | ||
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
8970
183
+ Addeddenque@1.5.1(transitive)
+ Addedioredis@3.2.2(transitive)
+ Addedlodash.assign@4.2.0(transitive)
+ Addedlodash.bind@4.2.1(transitive)
+ Addedlodash.clone@4.5.0(transitive)
+ Addedlodash.clonedeep@4.5.0(transitive)
+ Addedlodash.defaults@4.2.0(transitive)
+ Addedlodash.difference@4.5.0(transitive)
+ Addedlodash.flatten@4.4.0(transitive)
+ Addedlodash.foreach@4.5.0(transitive)
+ Addedlodash.isempty@4.4.0(transitive)
+ Addedlodash.keys@4.2.0(transitive)
+ Addedlodash.noop@3.0.1(transitive)
+ Addedlodash.partial@4.2.1(transitive)
+ Addedlodash.pick@4.4.0(transitive)
+ Addedlodash.sample@4.2.1(transitive)
+ Addedlodash.shuffle@4.2.0(transitive)
+ Addedlodash.values@4.3.0(transitive)
+ Addedredis-parser@2.6.0(transitive)
- Removeddouble-ended-queue@2.1.0-0(transitive)
- Removedioredis@2.5.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedredis-parser@1.3.0(transitive)
Updatedioredis@^3.0.0
Updatedlru-cache@^4.1.1