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

chore: add callback functionality back in

This also improves the performance for multi / batch commands a lot.
The reason is that now there are only callbacks internally even if
a promise is going to be returned in the end.
This commit is contained in:
Ruben Bridgewater
2017-11-29 19:16:40 -02:00
parent 2b4ab10305
commit d7c31da598
10 changed files with 288 additions and 184 deletions

View File

@@ -1,6 +1,6 @@
'use strict'
const Command = require('./command')
const { Command, MultiCommand } = require('./command')
function addCommand(clientProto, multiProto, command) {
// Some rare Redis commands use special characters in their command name
@@ -28,7 +28,7 @@ function addCommand(clientProto, multiProto, command) {
// Do not override existing functions
if (!multiProto[command] && command !== 'multi') {
multiProto[commandName] = function (...args) {
this._queue.push(new Command(command, args))
this._queue.push(new MultiCommand(command, args))
return this
}
if (!multiProto[commandName].name) {