redis-sentinel-client
Advanced tools
Comparing version 0.1.4 to 0.1.5
13
index.js
@@ -18,2 +18,3 @@ /** | ||
- port | ||
- masterOptions | ||
- masterName | ||
@@ -53,7 +54,5 @@ - logger (e.g. winston) | ||
var masterOptions = options.masterOptions || {}; | ||
masterOptions.disable_flush = true; // Disables flush_and_error, to preserve queue | ||
var masterOptions = { | ||
disable_flush: true // Disables flush_and_error, to preserve queue | ||
}; | ||
// if master & slaves need a password to authenticate, | ||
@@ -86,2 +85,6 @@ // pass it in as 'master_auth_pass'. | ||
// pass up pmessage | ||
self.activeMasterClient.on('pmessage', function(pattern, channel, message){ | ||
self.emit('pmessage', pattern, channel, message); | ||
}); | ||
@@ -183,3 +186,3 @@ // pass these through | ||
case '+failover-end': | ||
case '+switch-master': | ||
self.debug('Reconnect triggered by ' + msg); | ||
@@ -186,0 +189,0 @@ self.emit('failover-end'); |
{ | ||
"name": "redis-sentinel-client", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "Transparent Redis Sentinel client", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -53,2 +53,3 @@ # Redis Sentinel Client for Node.js | ||
- `masterName`: Which master the sentinel is listening to. Defaults to 'mymaster'. (If a sentinel is listening to multiple masters, create multiple `SentinelClients`.) | ||
- `masterOptions`: The options object which will be passed on to the Redis master client connection. See the [node_redis](https://github.com/mranney/node_redis#rediscreateclientport-host-options) documentation for more details. | ||
- `master_auth_pass`: If your master and slave(s) need authentication (`options.auth_pass` in node_redis, as of 0.8.5), this is passed on. (Note, the sentinel itself does not take authentication.) | ||
@@ -55,0 +56,0 @@ - `logger`: pass in [winston](https://github.com/flatiron/winston) or another custom logger, otherwises uses console. (Expects a `log` method.) |
@@ -168,3 +168,3 @@ /* | ||
suite('single', function(){ | ||
var key = 'test_single' | ||
var key = 'test_single', | ||
num = "9007199254740992"; | ||
@@ -263,3 +263,33 @@ | ||
suite('pubsub', function() { | ||
var client2 = RedisSentinel.createClient(PORT, HOST, { | ||
logger: new MockLogger(), | ||
debug: false | ||
}); | ||
test('should get pubsub messages', function(done){ | ||
client2.on('message', function(channel, message) { | ||
should.strictEqual(message, '123'); | ||
should.strictEqual(channel, 'pubsub'); | ||
done(); | ||
}); | ||
client2.subscribe('pubsub'); | ||
client.publish('pubsub', '123'); | ||
}); | ||
test('should get pmessages', function(done){ | ||
client2.on('pmessage', function(pattern, channel, message) { | ||
should.strictEqual(message, 'abc'); | ||
should.strictEqual(channel, 'channel1'); | ||
should.strictEqual(pattern, 'channel*'); | ||
done(); | ||
}); | ||
client2.psubscribe('channel*'); | ||
client.publish('channel1', 'abc'); | ||
}); | ||
}); | ||
// @todo more commands... | ||
@@ -266,0 +296,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
40284
904
111
3