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

Add name property to all Redis functions

This commit is contained in:
Ruben Bridgewater
2016-05-27 16:25:59 +02:00
parent 55528d8b1b
commit ffaaf0f6d5
3 changed files with 9 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ Features
- Updated [redis-parser](https://github.com/NodeRedis/redis-parser) dependency ([changelog](https://github.com/NodeRedis/redis-parser/releases/tag/v.2.0.0))
- The JS parser is from now on the new default as it is a lot faster than the hiredis parser
- This is no BC as there is no changed behavior for the user at all but just a performance improvement. Explicitly requireing the Hiredis parser is still possible.
- Added name property to all Redis functions
Bugfixes

View File

@@ -44,6 +44,9 @@ commands.list.forEach(function (command) {
}
return this.internal_send_command(command, arr, callback);
};
Object.defineProperty(RedisClient.prototype[command], 'name', {
value: command
});
}
// Do not override existing functions
@@ -82,5 +85,8 @@ commands.list.forEach(function (command) {
this.queue.push([command, arr, callback]);
return this;
};
Object.defineProperty(Multi.prototype[command], 'name', {
value: command
});
}
});

View File

@@ -96,7 +96,7 @@ function quit_callback (self, callback) {
};
}
RedisClient.prototype.QUIT = RedisClient.prototype.quit = function (callback) {
RedisClient.prototype.QUIT = RedisClient.prototype.quit = function quit (callback) {
// TODO: Consider this for v.3
// Allow the quit command to be fired as soon as possible to prevent it landing in the offline queue.
// this.ready = this.offline_queue.length === 0;
@@ -108,7 +108,7 @@ RedisClient.prototype.QUIT = RedisClient.prototype.quit = function (callback) {
};
// Only works with batch, not in a transaction
Multi.prototype.QUIT = Multi.prototype.quit = function (callback) {
Multi.prototype.QUIT = Multi.prototype.quit = function quit (callback) {
var self = this._client;
var call_on_write = function () {
// If called in a multi context, we expect redis is available