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

chore: refactor main code into smaller parts

This commit is contained in:
Ruben Bridgewater
2017-05-27 03:41:27 +02:00
parent be3976e8ba
commit 2aa3b68fc6
9 changed files with 205 additions and 190 deletions

View File

@@ -22,6 +22,14 @@ function onConnect (client) {
}
}
function sendOfflineQueue (client) {
while (client.offlineQueue.length) {
const command = client.offlineQueue.shift()
debug('Sending offline command: %s', command.command)
client.internalSendCommand(command)
}
}
function onReady (client) {
debug('onReady called %s id %s', client.address, client.connectionId)
client.ready = true
@@ -83,7 +91,7 @@ function onReady (client) {
}
}
}
client.sendOfflineQueue()
sendOfflineQueue(client)
client.emit('ready')
}