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

chore: mark private variables as such and remove obsolete ones

This commit is contained in:
Ruben Bridgewater
2017-05-28 07:15:20 +02:00
parent ba7a39c443
commit b2e18344d9
21 changed files with 179 additions and 165 deletions

View File

@@ -46,7 +46,7 @@ RedisClient.prototype.monitor = function monitor () {
const callOnWrite = () => {
// Activating monitor mode has to happen before Redis returned the callback. The monitor result is returned first.
// Therefore we expect the command to be properly processed. If this is not the case, it's not an issue either.
this.monitoring = true
this._monitoring = true
}
return this.internalSendCommand(new Command('monitor', [], callOnWrite))
}
@@ -54,16 +54,16 @@ RedisClient.prototype.monitor = function monitor () {
// Only works with batch, not in a transaction
Multi.prototype.monitor = function monitor () {
// Use a individual command, as this is a special case that does not has to be checked for any other command
if (this.exec !== this.execTransaction) {
if (this._type !== 'multi') {
const callOnWrite = () => {
this._client.monitoring = true
this._client._monitoring = true
}
this._queue.push(new Command('monitor', [], callOnWrite))
return this
}
// Set multi monitoring to indicate the exec that it should abort
// Remove this "hack" as soon as Redis might fix this
this.monitoring = true
this._monitoring = true
return this
}
@@ -91,7 +91,7 @@ RedisClient.prototype.quit = function quit () {
// this.ready = this.offlineQueue.length === 0;
const backpressureIndicator = this.internalSendCommand(new Command('quit', [], null, quitCallback(this)))
// Calling quit should always end the connection, no matter if there's a connection or not
this.closing = true
this._closing = true
this.ready = false
return backpressureIndicator
}
@@ -100,7 +100,7 @@ RedisClient.prototype.quit = function quit () {
Multi.prototype.quit = function quit () {
const callOnWrite = () => {
// If called in a multi context, we expect redis is available
this._client.closing = true
this._client._closing = true
this._client.ready = false
}
this._queue.push(new Command('quit', [], null, quitCallback(this._client), callOnWrite))
@@ -198,7 +198,7 @@ RedisClient.prototype.auth = function auth (pass) {
debug('Sending auth to %s id %s', this.address, this.connectionId)
// Stash auth for connect and reconnect.
this.authPass = pass
this._options.password = pass
const ready = this.ready
this.ready = ready || this.offlineQueue.length === 0
const tmp = this.internalSendCommand(new Command('auth', [pass], null, authCallback(this, pass)))
@@ -211,7 +211,7 @@ Multi.prototype.auth = function auth (pass) {
debug('Sending auth to %s id %s', this.address, this.connectionId)
// Stash auth for connect and reconnect.
this.authPass = pass
this._client._options.password = pass
this._queue.push(new Command('auth', [pass], null, authCallback(this._client)))
return this
}
@@ -229,7 +229,7 @@ RedisClient.prototype.client = function client () {
const replyOnOff = arr[1].toString().toUpperCase()
if (replyOnOff === 'ON' || replyOnOff === 'OFF' || replyOnOff === 'SKIP') {
callOnWrite = () => {
this.reply = replyOnOff
this._reply = replyOnOff
}
}
}
@@ -249,7 +249,7 @@ Multi.prototype.client = function client () {
const replyOnOff = arr[1].toString().toUpperCase()
if (replyOnOff === 'ON' || replyOnOff === 'OFF' || replyOnOff === 'SKIP') {
callOnWrite = () => {
this._client.reply = replyOnOff
this._client._reply = replyOnOff
}
}
}
@@ -264,7 +264,7 @@ RedisClient.prototype.subscribe = function subscribe () {
arr[i] = arguments[i]
}
const callOnWrite = () => {
this.pubSubMode = this.pubSubMode || this.commandQueue.length + 1
this._pubSubMode = this._pubSubMode || this.commandQueue.length + 1
}
return this.internalSendCommand(new Command('subscribe', arr, callOnWrite))
}
@@ -276,7 +276,7 @@ Multi.prototype.subscribe = function subscribe () {
arr[i] = arguments[i]
}
const callOnWrite = () => {
this._client.pubSubMode = this._client.pubSubMode || this._client.commandQueue.length + 1
this._client._pubSubMode = this._client._pubSubMode || this._client.commandQueue.length + 1
}
this._queue.push(new Command('subscribe', arr, callOnWrite))
return this
@@ -290,7 +290,7 @@ RedisClient.prototype.unsubscribe = function unsubscribe () {
}
const callOnWrite = () => {
// Pub sub has to be activated even if not in pub sub mode, as the return value is manipulated in the callback
this.pubSubMode = this.pubSubMode || this.commandQueue.length + 1
this._pubSubMode = this._pubSubMode || this.commandQueue.length + 1
}
return this.internalSendCommand(new Command('unsubscribe', arr, callOnWrite))
}
@@ -303,7 +303,7 @@ Multi.prototype.unsubscribe = function unsubscribe () {
}
const callOnWrite = () => {
// Pub sub has to be activated even if not in pub sub mode, as the return value is manipulated in the callback
this._client.pubSubMode = this._client.pubSubMode || this._client.commandQueue.length + 1
this._client._pubSubMode = this._client._pubSubMode || this._client.commandQueue.length + 1
}
this._queue.push(new Command('unsubscribe', arr, callOnWrite))
return this
@@ -316,7 +316,7 @@ RedisClient.prototype.psubscribe = function psubscribe () {
arr[i] = arguments[i]
}
const callOnWrite = () => {
this.pubSubMode = this.pubSubMode || this.commandQueue.length + 1
this._pubSubMode = this._pubSubMode || this.commandQueue.length + 1
}
return this.internalSendCommand(new Command('psubscribe', arr, callOnWrite))
}
@@ -328,7 +328,7 @@ Multi.prototype.psubscribe = function psubscribe () {
arr[i] = arguments[i]
}
const callOnWrite = () => {
this._client.pubSubMode = this._client.pubSubMode || this._client.commandQueue.length + 1
this._client._pubSubMode = this._client._pubSubMode || this._client.commandQueue.length + 1
}
this._queue.push(new Command('psubscribe', arr, callOnWrite))
return this
@@ -342,7 +342,7 @@ RedisClient.prototype.punsubscribe = function punsubscribe () {
}
const callOnWrite = () => {
// Pub sub has to be activated even if not in pub sub mode, as the return value is manipulated in the callback
this.pubSubMode = this.pubSubMode || this.commandQueue.length + 1
this._pubSubMode = this._pubSubMode || this.commandQueue.length + 1
}
return this.internalSendCommand(new Command('punsubscribe', arr, callOnWrite))
}
@@ -355,7 +355,7 @@ Multi.prototype.punsubscribe = function punsubscribe () {
}
const callOnWrite = () => {
// Pub sub has to be activated even if not in pub sub mode, as the return value is manipulated in the callback
this._client.pubSubMode = this._client.pubSubMode || this._client.commandQueue.length + 1
this._client._pubSubMode = this._client._pubSubMode || this._client.commandQueue.length + 1
}
this._queue.push(new Command('punsubscribe', arr, callOnWrite))
return this