You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
Remove socket_no_delay
This commit is contained in:
committed by
Ruben Bridgewater
parent
f20f704a3e
commit
2f6c421006
@@ -231,9 +231,6 @@ Deprecations
|
||||
- Using .end without flush means that any command that did not yet return is going to silently fail. Therefor this is considered harmful and you should explicitly silence such errors if you are sure you want this
|
||||
- Depending on the return value of a command to detect the backpressure is deprecated
|
||||
- From version 3.0.0 on node_redis might not return true / false as a return value anymore. Please rely on client.should_buffer instead
|
||||
- The `socket_nodelay` option is deprecated and will be removed in v.3.0.0
|
||||
- If you want to buffer commands you should use [.batch or .multi](./README.md) instead. This is necessary to reduce the amount of different options and this is very likely reducing your throughput if set to false.
|
||||
- If you are sure you want to activate the NAGLE algorithm you can still activate it by using client.stream.setNoDelay(false)
|
||||
- The `max_attempts` option is deprecated and will be removed in v.3.0.0. Please use the `retry_strategy` instead
|
||||
- The `retry_max_delay` option is deprecated and will be removed in v.3.0.0. Please use the `retry_strategy` instead
|
||||
- The drain event is deprecated and will be removed in v.3.0.0. Please listen to the stream drain event instead
|
||||
|
13
index.js
13
index.js
@@ -89,15 +89,6 @@ function RedisClient (options, stream) {
|
||||
this.connection_id = RedisClient.connection_id++;
|
||||
this.connected = false;
|
||||
this.ready = false;
|
||||
if (options.socket_nodelay === undefined) {
|
||||
options.socket_nodelay = true;
|
||||
} else if (!options.socket_nodelay) { // Only warn users with this set to false
|
||||
self.warn(
|
||||
'socket_nodelay is deprecated and will be removed in v.3.0.0.\n' +
|
||||
'Setting socket_nodelay to false likely results in a reduced throughput. Please use .batch for pipelining instead.\n' +
|
||||
'If you are sure you rely on the NAGLE-algorithm you can activate it by calling client.stream.setNoDelay(false) instead.'
|
||||
);
|
||||
}
|
||||
if (options.socket_keepalive === undefined) {
|
||||
options.socket_keepalive = true;
|
||||
}
|
||||
@@ -297,10 +288,6 @@ RedisClient.prototype.create_stream = function () {
|
||||
self.drain();
|
||||
});
|
||||
|
||||
if (this.options.socket_nodelay) {
|
||||
this.stream.setNoDelay();
|
||||
}
|
||||
|
||||
// Fire the command before redis is connected to be sure it's the first fired command
|
||||
if (this.auth_pass !== undefined) {
|
||||
this.ready = true;
|
||||
|
@@ -757,83 +757,6 @@ describe('The node_redis client', function () {
|
||||
// });
|
||||
});
|
||||
|
||||
describe('socket_nodelay', function () {
|
||||
describe('true', function () {
|
||||
var args = config.configureClient(parser, ip, {
|
||||
socket_nodelay: true
|
||||
});
|
||||
|
||||
it("fires client.on('ready')", function (done) {
|
||||
client = redis.createClient.apply(null, args);
|
||||
client.on('ready', function () {
|
||||
assert.strictEqual(true, client.options.socket_nodelay);
|
||||
client.quit(done);
|
||||
});
|
||||
});
|
||||
|
||||
it('client is functional', function (done) {
|
||||
client = redis.createClient.apply(null, args);
|
||||
client.on('ready', function () {
|
||||
assert.strictEqual(true, client.options.socket_nodelay);
|
||||
client.set(['set key 1', 'set val'], helper.isString('OK'));
|
||||
client.set(['set key 2', 'set val'], helper.isString('OK'));
|
||||
client.get(['set key 1'], helper.isString('set val'));
|
||||
client.get(['set key 2'], helper.isString('set val'));
|
||||
client.quit(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('false', function () {
|
||||
var args = config.configureClient(parser, ip, {
|
||||
socket_nodelay: false
|
||||
});
|
||||
|
||||
it("fires client.on('ready')", function (done) {
|
||||
client = redis.createClient.apply(null, args);
|
||||
client.on('ready', function () {
|
||||
assert.strictEqual(false, client.options.socket_nodelay);
|
||||
client.quit(done);
|
||||
});
|
||||
});
|
||||
|
||||
it('client is functional', function (done) {
|
||||
client = redis.createClient.apply(null, args);
|
||||
client.on('ready', function () {
|
||||
assert.strictEqual(false, client.options.socket_nodelay);
|
||||
client.set(['set key 1', 'set val'], helper.isString('OK'));
|
||||
client.set(['set key 2', 'set val'], helper.isString('OK'));
|
||||
client.get(['set key 1'], helper.isString('set val'));
|
||||
client.get(['set key 2'], helper.isString('set val'));
|
||||
client.quit(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('defaults to true', function () {
|
||||
|
||||
it("fires client.on('ready')", function (done) {
|
||||
client = redis.createClient.apply(null, args);
|
||||
client.on('ready', function () {
|
||||
assert.strictEqual(true, client.options.socket_nodelay);
|
||||
client.quit(done);
|
||||
});
|
||||
});
|
||||
|
||||
it('client is functional', function (done) {
|
||||
client = redis.createClient.apply(null, args);
|
||||
client.on('ready', function () {
|
||||
assert.strictEqual(true, client.options.socket_nodelay);
|
||||
client.set(['set key 1', 'set val'], helper.isString('OK'));
|
||||
client.set(['set key 2', 'set val'], helper.isString('OK'));
|
||||
client.get(['set key 1'], helper.isString('set val'));
|
||||
client.get(['set key 2'], helper.isString('set val'));
|
||||
client.quit(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('retry_max_delay', function () {
|
||||
it('sets upper bound on how long client waits before reconnecting', function (done) {
|
||||
var time;
|
||||
|
Reference in New Issue
Block a user