Socket
Socket
Sign inDemoInstall

ioredis

Package Overview
Dependencies
Maintainers
1
Versions
228
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ioredis - npm Package Compare versions

Comparing version 1.1.4 to 1.2.0

.idea/misc.xml

1

API.md

@@ -52,2 +52,3 @@ ## Classes

| [options.autoResubscribe] | <code>boolean</code> | <code>true</code> | After reconnected, if the previous connection was in the subscriber mode, client will auto re-subscribe these channels. |
| [options.autoResendUnfulfilledCommands] | <code>boolean</code> | <code>true</code> | If true, client will resend unfulfilled commands(e.g. block commands) in the previous connection when reconnected. |
| [options.lazyConnect] | <code>boolean</code> | <code>false</code> | By default, When a new `Redis` instance is created, it will connect to Redis server automatically. If you want to keep disconnected util a command is called, you can pass the `lazyConnect` option to the constructor: ```javascript var redis = new Redis({ lazyConnect: true }); // No attempting to connect to the Redis server here. // Now let's connect to the Redis server redis.get('foo', function () { }); ``` |

@@ -54,0 +55,0 @@ | [options.retryStrategy] | <code>function</code> | | See "Quick Start" section |

@@ -5,2 +5,6 @@ ## Changelog

### v1.2.0 - May 4, 2015
* Add `autoResendUnfulfilledCommands` option.
### v1.1.4 - May 3, 2015

@@ -7,0 +11,0 @@

@@ -55,2 +55,3 @@ 'use strict';

* @param {boolean} [options.autoResubscribe=true] - After reconnected, if the previous connection was in the subscriber mode, client will auto re-subscribe these channels.
* @param {boolean} [options.autoResendUnfulfilledCommands=true] - If true, client will resend unfulfilled commands(e.g. block commands) in the previous connection when reconnected.
* @param {boolean} [options.lazyConnect=false] - By default,

@@ -165,2 +166,3 @@ * When a new `Redis` instance is created, it will connect to Redis server automatically.

autoResubscribe: true,
autoResendUnfulfilledCommands: true,
lazyConnect: false

@@ -167,0 +169,0 @@ };

@@ -48,2 +48,5 @@ 'use strict';

self.prevCondition = self.condition;
if (self.commandQueue.length) {
self.prevCommandQueue = self.commandQueue;
}

@@ -98,2 +101,14 @@ if (self.manuallyClosing) {

if (self.prevCommandQueue) {
if (self.options.autoResendUnfulfilledCommands) {
debug('resend %d unfulfilled commands', self.prevCommandQueue.length);
while (self.prevCommandQueue.length) {
var command = self.prevCommandQueue.shift();
self.sendCommand(command);
}
} else {
self.prevCommandQueue = null;
}
}
var finalSelect = self.condition.select;

@@ -100,0 +115,0 @@ self.condition.select = 0;

2

package.json
{
"name": "ioredis",
"version": "1.1.4",
"version": "1.2.0",
"description": "A delightful, performance-focused Redis client for Node and io.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -393,2 +393,8 @@ # ioredis

When reconnected, client will auto subscribe channels that the previous connection has subscribed.
This behavious can be disabled by setting `autoResubscribe` option to `false`.
And if the previous connection has some unfulfilled commands(most likely are block commands such as `brpop` and `blpop`),
client will resend them when reconnected. This behavious can be disabled by setting `autoResendUnfulfilledCommands` option to `false`.
## Connection Events

@@ -395,0 +401,0 @@ Redis instance will emit some events about the state of the connection to the Redis server.

@@ -94,2 +94,27 @@ 'use strict';

});
describe('autoResendUnfulfilledCommands', function () {
it('should resend unfulfilled when reconnected', function (done) {
var redis = new Redis();
var pub = new Redis();
redis.once('ready', function () {
var write = redis.stream.write;
redis.stream.write = function () {
write.apply(redis.stream, arguments);
redis.stream.write = write;
redis.stream.end();
};
redis.blpop('l', 0, function (err, res) {
expect(res[0]).to.eql('l');
expect(res[1]).to.eql('1');
done();
});
});
redis.once('end', function () {
pub.lpush('l', 1, function () {
redis.connect();
});
});
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc