diff --git a/index.js b/index.js index 5848279e00..e6e565c59b 100644 --- a/index.js +++ b/index.js @@ -63,7 +63,7 @@ function RedisClient (options, stream) { cnx_options.family = (!options.family && net.isIP(cnx_options.host)) || (options.family === 'IPv6' ? 6 : 4); this.address = cnx_options.host + ':' + cnx_options.port; } - /* istanbul ignore next: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */ + /* istanbul ignore next: travis does not work with stunnel atm. Therefore the tls tests are skipped on travis */ for (var tls_option in options.tls) { // jshint ignore: line cnx_options[tls_option] = options.tls[tls_option]; } @@ -220,7 +220,7 @@ RedisClient.prototype.create_stream = function () { this.stream.destroy(); } - /* istanbul ignore if: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */ + /* istanbul ignore if: travis does not work with stunnel atm. Therefore the tls tests are skipped on travis */ if (this.options.tls) { this.stream = tls.connect(this.connection_options); } else { @@ -230,12 +230,13 @@ RedisClient.prototype.create_stream = function () { if (this.options.connect_timeout) { this.stream.setTimeout(this.connect_timeout, function () { + // Note: This is only tested if a internet connection is established self.retry_totaltime = self.connect_timeout; self.connection_gone('timeout', new Error('Redis connection gone from timeout event')); }); } - /* istanbul ignore next: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */ + /* istanbul ignore next: travis does not work with stunnel atm. Therefore the tls tests are skipped on travis */ var connect_event = this.options.tls ? 'secureConnect' : 'connect'; this.stream.once(connect_event, function () { this.removeAllListeners('timeout'); @@ -244,7 +245,7 @@ RedisClient.prototype.create_stream = function () { }); this.stream.on('data', function (buffer_from_socket) { - // The buffer_from_socket.toString() has a significant impact on big chunks and therefor this should only be used if necessary + // The buffer_from_socket.toString() has a significant impact on big chunks and therefore this should only be used if necessary debug('Net read ' + self.address + ' id ' + self.connection_id); // + ': ' + buffer_from_socket.toString()); self.reply_parser.execute(buffer_from_socket); self.emit_idle(); @@ -400,12 +401,12 @@ RedisClient.prototype.on_ready = function () { this.pub_sub_mode = this.old_state.pub_sub_mode; } if (this.monitoring) { // Monitor has to be fired before pub sub commands - this.internal_send_command('monitor', []); + this.internal_send_command('monitor', []); // The state is still set } var callback_count = Object.keys(this.subscription_set).length; if (!this.options.disable_resubscribing && callback_count) { // only emit 'ready' when all subscriptions were made again - // TODO: Remove the countdown for ready here. This is not coherent with all other modes and should therefor not be handled special + // TODO: Remove the countdown for ready here. This is not coherent with all other modes and should therefore not be handled special // We know we are ready as soon as all commands were fired var callback = function () { callback_count--; @@ -680,7 +681,7 @@ function subscribe_unsubscribe (self, reply, type, subscribe) { } else { var running_command; var i = 1; - // This should be a rare case and therefor handling it this way should be good performance wise for the general case + // This should be a rare case and therefore handling it this way should be good performance wise for the general case while (running_command = self.command_queue.get(i)) { if (SUBSCRIBE_COMMANDS[running_command.command]) { self.command_queue.shift(); diff --git a/lib/extendedApi.js b/lib/extendedApi.js index 21013146b5..5cd78038f0 100644 --- a/lib/extendedApi.js +++ b/lib/extendedApi.js @@ -39,7 +39,7 @@ RedisClient.prototype.send_command = RedisClient.prototype.sendCommand = functio return this.internal_send_command(command, args, callback); } if (typeof callback === 'function') { - args = args.concat([callback]); + args = args.concat([callback]); // Prevent manipulating the input array } return this[command].apply(this, args); }; diff --git a/lib/utils.js b/lib/utils.js index f5a5c902e1..1b6ee62124 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -3,7 +3,7 @@ var RawObject = require('./rawObject'); // hgetall converts its replies to an Object. If the reply is empty, null is returned. -// These function are only called with internal data and have therefor always the same instanceof X +// These function are only called with internal data and have therefore always the same instanceof X function replyToObject (reply) { // The reply might be a string or a buffer if this is called in a transaction (multi) if (reply.length === 0 || !(reply instanceof Array)) { diff --git a/test/auth.spec.js b/test/auth.spec.js index 2e28f895df..4c262dccd2 100644 --- a/test/auth.spec.js +++ b/test/auth.spec.js @@ -53,7 +53,7 @@ describe('client authentication', function () { client.auth(auth, function (err, res) { assert.strictEqual('retry worked', res); var now = Date.now(); - // Hint: setTimeout sometimes triggers early and therefor the value can be like one or two ms to early + // Hint: setTimeout sometimes triggers early and therefore the value can be like one or two ms to early assert(now - time >= 98, 'Time should be above 100 ms (the reconnect time) and is ' + (now - time)); assert(now - time < 225, 'Time should be below 255 ms (the reconnect should only take a bit above 100 ms) and is ' + (now - time)); done(); diff --git a/test/connection.spec.js b/test/connection.spec.js index 41de60b3b4..ad91730c35 100644 --- a/test/connection.spec.js +++ b/test/connection.spec.js @@ -20,7 +20,7 @@ describe('connection tests', function () { it('unofficially support for a private stream', function () { // While using a private stream, reconnection and other features are not going to work properly. // Besides that some functions also have to be monkey patched to be safe from errors in this case. - // Therefor this is not officially supported! + // Therefore this is not officially supported! var socket = new net.Socket(); client = new redis.RedisClient({ prefix: 'test' diff --git a/test/node_redis.spec.js b/test/node_redis.spec.js index e556dc7505..02a10f7c95 100644 --- a/test/node_redis.spec.js +++ b/test/node_redis.spec.js @@ -597,7 +597,7 @@ describe('The node_redis client', function () { assert.strictEqual(typeof rawOutput, 'string'); assert(utils.monitor_regex.test(rawOutput), rawOutput); assert.deepEqual(args, ['mget', 'hello', 'world']); - // Quit immediatly ends monitoring mode and therefor does not stream back the quit command + // Quit immediatly ends monitoring mode and therefore does not stream back the quit command monitorClient.quit(done); }); }); @@ -668,7 +668,7 @@ describe('The node_redis client', function () { assert.deepEqual(responses[5], ['unsubscribe', 'baz']); assert.deepEqual(responses[6], ['publish', '/foo', 'hello world']); // The publish is called right after the reconnect and the monitor is called before the message is emitted. - // Therefor we have to wait till the next tick + // Therefore we have to wait till the next tick process.nextTick(function () { assert(called); client.quit(done); @@ -891,7 +891,7 @@ describe('The node_redis client', function () { client.set('foo', 'bar', function (err, res) { assert.strictEqual(err.message, 'Protocol error, got "a" as reply type byte'); }); - // Fail the set answer. Has no corresponding command obj and will therefor land in the error handler and set + // Fail the set answer. Has no corresponding command obj and will therefore land in the error handler and set client.reply_parser.execute(new Buffer('a*1\r*1\r$1`zasd\r\na')); }); });