Skip to content

Commit 5bb564b

Browse files
committed
fix bad readed code
1 parent 60f8ee4 commit 5bb564b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/extendedApi.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ RedisClient.prototype.send_command = RedisClient.prototype.sendCommand = functio
4343
}
4444

4545
// Using the raw multi command is only possible with this function
46-
// If the command is not yet added to the client, the internal function should be called right away
47-
// Otherwise we need to redirect the calls to make sure the internal functions don't get skipped
46+
// If the command is added to the client we need to redirect the calls to make sure the internal functions don't get skipped
47+
// Otherwise we should call internal_send_command
4848
// The internal functions could actually be used for any non hooked function
4949
// but this might change from time to time and at the moment there's no good way to distinguishe them
5050
// from each other, so let's just do it do it this way for the time being
51-
if (command === 'multi' || typeof this[command] !== 'function') {
52-
return this.internal_send_command(new Command(command, args, callback));
53-
}
54-
if (typeof callback === 'function') {
55-
args = args.concat([callback]); // Prevent manipulating the input array
51+
if (typeof this[command] === 'function' && command !== 'multi') {
52+
if (typeof callback === 'function') {
53+
args = args.concat([callback]); // Prevent manipulating the input array
54+
}
55+
return this[command].apply(this, args);
5656
}
57-
return this[command].apply(this, args);
57+
return this.internal_send_command(new Command(command, args, callback));
5858
};
5959

6060
RedisClient.prototype.end = function (flush) {

0 commit comments

Comments
 (0)