Skip to content

Commit 5d12659

Browse files
author
Ruben Bridgewater
committed
Fix typos / comments
1 parent cd58e1f commit 5d12659

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

index.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function RedisClient (options, stream) {
6363
cnx_options.family = (!options.family && net.isIP(cnx_options.host)) || (options.family === 'IPv6' ? 6 : 4);
6464
this.address = cnx_options.host + ':' + cnx_options.port;
6565
}
66-
/* istanbul ignore next: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */
66+
/* istanbul ignore next: travis does not work with stunnel atm. Therefore the tls tests are skipped on travis */
6767
for (var tls_option in options.tls) { // jshint ignore: line
6868
cnx_options[tls_option] = options.tls[tls_option];
6969
}
@@ -220,7 +220,7 @@ RedisClient.prototype.create_stream = function () {
220220
this.stream.destroy();
221221
}
222222

223-
/* istanbul ignore if: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */
223+
/* istanbul ignore if: travis does not work with stunnel atm. Therefore the tls tests are skipped on travis */
224224
if (this.options.tls) {
225225
this.stream = tls.connect(this.connection_options);
226226
} else {
@@ -230,12 +230,13 @@ RedisClient.prototype.create_stream = function () {
230230

231231
if (this.options.connect_timeout) {
232232
this.stream.setTimeout(this.connect_timeout, function () {
233+
// Note: This is only tested if a internet connection is established
233234
self.retry_totaltime = self.connect_timeout;
234235
self.connection_gone('timeout', new Error('Redis connection gone from timeout event'));
235236
});
236237
}
237238

238-
/* istanbul ignore next: travis does not work with stunnel atm. Therefor the tls tests are skipped on travis */
239+
/* istanbul ignore next: travis does not work with stunnel atm. Therefore the tls tests are skipped on travis */
239240
var connect_event = this.options.tls ? 'secureConnect' : 'connect';
240241
this.stream.once(connect_event, function () {
241242
this.removeAllListeners('timeout');
@@ -244,7 +245,7 @@ RedisClient.prototype.create_stream = function () {
244245
});
245246

246247
this.stream.on('data', function (buffer_from_socket) {
247-
// The buffer_from_socket.toString() has a significant impact on big chunks and therefor this should only be used if necessary
248+
// The buffer_from_socket.toString() has a significant impact on big chunks and therefore this should only be used if necessary
248249
debug('Net read ' + self.address + ' id ' + self.connection_id); // + ': ' + buffer_from_socket.toString());
249250
self.reply_parser.execute(buffer_from_socket);
250251
self.emit_idle();
@@ -400,12 +401,12 @@ RedisClient.prototype.on_ready = function () {
400401
this.pub_sub_mode = this.old_state.pub_sub_mode;
401402
}
402403
if (this.monitoring) { // Monitor has to be fired before pub sub commands
403-
this.internal_send_command('monitor', []);
404+
this.internal_send_command('monitor', []); // The state is still set
404405
}
405406
var callback_count = Object.keys(this.subscription_set).length;
406407
if (!this.options.disable_resubscribing && callback_count) {
407408
// only emit 'ready' when all subscriptions were made again
408-
// TODO: Remove the countdown for ready here. This is not coherent with all other modes and should therefor not be handled special
409+
// TODO: Remove the countdown for ready here. This is not coherent with all other modes and should therefore not be handled special
409410
// We know we are ready as soon as all commands were fired
410411
var callback = function () {
411412
callback_count--;
@@ -680,7 +681,7 @@ function subscribe_unsubscribe (self, reply, type, subscribe) {
680681
} else {
681682
var running_command;
682683
var i = 1;
683-
// This should be a rare case and therefor handling it this way should be good performance wise for the general case
684+
// This should be a rare case and therefore handling it this way should be good performance wise for the general case
684685
while (running_command = self.command_queue.get(i)) {
685686
if (SUBSCRIBE_COMMANDS[running_command.command]) {
686687
self.command_queue.shift();

lib/extendedApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ RedisClient.prototype.send_command = RedisClient.prototype.sendCommand = functio
3939
return this.internal_send_command(command, args, callback);
4040
}
4141
if (typeof callback === 'function') {
42-
args = args.concat([callback]);
42+
args = args.concat([callback]); // Prevent manipulating the input array
4343
}
4444
return this[command].apply(this, args);
4545
};

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var RawObject = require('./rawObject');
44

55
// hgetall converts its replies to an Object. If the reply is empty, null is returned.
6-
// These function are only called with internal data and have therefor always the same instanceof X
6+
// These function are only called with internal data and have therefore always the same instanceof X
77
function replyToObject (reply) {
88
// The reply might be a string or a buffer if this is called in a transaction (multi)
99
if (reply.length === 0 || !(reply instanceof Array)) {

test/auth.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('client authentication', function () {
5353
client.auth(auth, function (err, res) {
5454
assert.strictEqual('retry worked', res);
5555
var now = Date.now();
56-
// Hint: setTimeout sometimes triggers early and therefor the value can be like one or two ms to early
56+
// Hint: setTimeout sometimes triggers early and therefore the value can be like one or two ms to early
5757
assert(now - time >= 98, 'Time should be above 100 ms (the reconnect time) and is ' + (now - time));
5858
assert(now - time < 225, 'Time should be below 255 ms (the reconnect should only take a bit above 100 ms) and is ' + (now - time));
5959
done();

test/connection.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('connection tests', function () {
2020
it('unofficially support for a private stream', function () {
2121
// While using a private stream, reconnection and other features are not going to work properly.
2222
// Besides that some functions also have to be monkey patched to be safe from errors in this case.
23-
// Therefor this is not officially supported!
23+
// Therefore this is not officially supported!
2424
var socket = new net.Socket();
2525
client = new redis.RedisClient({
2626
prefix: 'test'

test/node_redis.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ describe('The node_redis client', function () {
597597
assert.strictEqual(typeof rawOutput, 'string');
598598
assert(utils.monitor_regex.test(rawOutput), rawOutput);
599599
assert.deepEqual(args, ['mget', 'hello', 'world']);
600-
// Quit immediatly ends monitoring mode and therefor does not stream back the quit command
600+
// Quit immediatly ends monitoring mode and therefore does not stream back the quit command
601601
monitorClient.quit(done);
602602
});
603603
});
@@ -668,7 +668,7 @@ describe('The node_redis client', function () {
668668
assert.deepEqual(responses[5], ['unsubscribe', 'baz']);
669669
assert.deepEqual(responses[6], ['publish', '/foo', 'hello world']);
670670
// The publish is called right after the reconnect and the monitor is called before the message is emitted.
671-
// Therefor we have to wait till the next tick
671+
// Therefore we have to wait till the next tick
672672
process.nextTick(function () {
673673
assert(called);
674674
client.quit(done);
@@ -891,7 +891,7 @@ describe('The node_redis client', function () {
891891
client.set('foo', 'bar', function (err, res) {
892892
assert.strictEqual(err.message, 'Protocol error, got "a" as reply type byte');
893893
});
894-
// Fail the set answer. Has no corresponding command obj and will therefor land in the error handler and set
894+
// Fail the set answer. Has no corresponding command obj and will therefore land in the error handler and set
895895
client.reply_parser.execute(new Buffer('a*1\r*1\r$1`zasd\r\na'));
896896
});
897897
});

0 commit comments

Comments
 (0)