From 2f6c42100630cc97100d8b4bec75e3b3da4c7a11 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Sat, 17 Dec 2016 17:22:11 +0100 Subject: [PATCH] Remove socket_no_delay --- changelog.md | 3 -- index.js | 13 ------- test/node_redis.spec.js | 77 ----------------------------------------- 3 files changed, 93 deletions(-) diff --git a/changelog.md b/changelog.md index 60ab4e58f1..bd8d1496b6 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/index.js b/index.js index 770828ae95..361a6d70f8 100644 --- a/index.js +++ b/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; diff --git a/test/node_redis.spec.js b/test/node_redis.spec.js index d9fbc09728..1ba3dd946f 100644 --- a/test/node_redis.spec.js +++ b/test/node_redis.spec.js @@ -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;