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

chore - remove standard and use individual config

Standard is not as up to date and still uses a old eslint version.
Instead, use the airbnb default with a couple of modifications.

All required changes are included.
This commit is contained in:
Ruben Bridgewater
2017-11-28 21:38:21 -02:00
parent 0206ecbf51
commit 2b4ab10305
97 changed files with 888 additions and 673 deletions

View File

@@ -4,7 +4,7 @@ const Command = require('./command')
const debug = require('./debug')
const utils = require('./utils')
function onConnect (client) {
function onConnect(client) {
debug('Stream connected %s id %s', client.address, client.connectionId)
// TODO: Check if the clients prototype and the clients instance have
@@ -30,7 +30,7 @@ function onConnect (client) {
*
* @param {RedisClient} client
*/
function sendOfflineQueue (client) {
function sendOfflineQueue(client) {
const queue = client.offlineQueue
while (queue.length) {
const command = queue.shift()
@@ -47,7 +47,7 @@ function sendOfflineQueue (client) {
*
* @param {RedisClient} client
*/
function readyHandler (client) {
function readyHandler(client) {
debug('readyHandler called %s id %s', client.address, client.connectionId)
client.ready = true
@@ -79,16 +79,16 @@ function readyHandler (client) {
// }
if (!client._options.disableResubscribing && callbackCount) {
debug('Sending pub/sub commands')
for (const key in client._subscriptionSet) {
if (client._subscriptionSet.hasOwnProperty(key)) {
const command = key.slice(0, key.indexOf('_'))
const args = client._subscriptionSet[key]
client[command]([args]).catch((err) => {
if (!client._closing) {
process.nextTick(client.emit, 'error', err)
}
})
}
const keys = Object.keys(client._subscriptionSet)
for (var i = 0; i < keys.length; i++) {
const key = keys[i]
const command = key.slice(0, key.indexOf('_'))
const args = client._subscriptionSet[key]
client[command]([args]).catch((err) => {
if (!client._closing) {
process.nextTick(client.emit, 'error', err)
}
})
}
}
sendOfflineQueue(client)
@@ -100,7 +100,7 @@ function readyHandler (client) {
*
* @param {RedisClient} client
*/
function readyCheck (client) {
function readyCheck(client) {
debug('Checking server ready state...')
// Always fire client info command as first command even if other commands are already queued up
client.ready = true
@@ -112,7 +112,9 @@ function readyCheck (client) {
}
const persistence = client.serverInfo.persistence
if (persistence === undefined || persistence.loading === undefined || persistence.loading === 0) {
if (persistence === undefined ||
persistence.loading === undefined ||
persistence.loading === 0) {
// If the master_link_status exists but the link is not up, try again after 50 ms
const replication = client.serverInfo.replication
if (replication && typeof replication.master_link_status === 'string' && replication.master_link_status !== 'up') {
@@ -125,12 +127,12 @@ function readyCheck (client) {
}
}
var retryTime = +persistence.loading_eta_seconds * 1000
let retryTime = +persistence.loading_eta_seconds * 1000
if (retryTime > 1000) {
retryTime = 1000
}
debug('Redis server still loading, trying again in %s', retryTime)
setTimeout((client) => readyCheck(client), retryTime, client)
setTimeout(client => readyCheck(client), retryTime, client)
}).catch((err) => {
if (client._closing) {
return
@@ -142,7 +144,6 @@ function readyCheck (client) {
}
err.message = `Ready check failed: ${err.message}`
client.emit('error', err)
return
})
client.ready = false
}