1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-06 02:15:48 +03:00

Fix typos / comments

This commit is contained in:
Ruben Bridgewater
2016-04-13 04:29:02 +02:00
parent cd58e1fd89
commit 5d12659583
6 changed files with 15 additions and 14 deletions

View File

@@ -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();

View File

@@ -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);
};

View File

@@ -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)) {

View File

@@ -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();

View File

@@ -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'

View File

@@ -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'));
});
});