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

chore: add print helper again and refactor some code

Expose the RedisClient directly instead of only being a property
This commit is contained in:
Ruben Bridgewater
2017-05-29 18:23:24 +02:00
parent 4e593587cb
commit 0276e15f04
14 changed files with 169 additions and 104 deletions

View File

@@ -40,7 +40,7 @@ function onResult (client, reply) {
// If in monitor mode, all normal commands are still working and we only want to emit the streamlined commands
// As this is not the average use case and monitor is expensive anyway, let's change the code here, to improve
// the average performance of all other commands in case of no monitor mode
if (client._monitoring) {
if (client._monitoring === true) {
var replyStr
if (client.buffers && Buffer.isBuffer(reply)) {
replyStr = reply.toString()
@@ -63,6 +63,7 @@ function onResult (client, reply) {
} else if (client._pubSubMode !== 1) {
client._pubSubMode--
normalReply(client, reply)
// TODO: Have another look at this if this could be further improved
} else if (!(reply instanceof Array) || reply.length <= 2) {
// Only PING and QUIT are allowed in this context besides the pub sub commands
// Ping replies with ['pong', null|value] and quit with 'OK'