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

feat: add auto pipeline

This commit is contained in:
Ruben Bridgewater
2017-05-28 04:31:37 +02:00
parent 8c63233968
commit 0d53d3dcdf
8 changed files with 79 additions and 121 deletions

View File

@@ -6,6 +6,9 @@ const Command = require('./command')
function onConnect (client) {
debug('Stream connected %s id %s', client.address, client.connectionId)
// TODO: Check if the clients prototype and the clients instance have
// fast properties. If that's not the case, make them fast properties
// again!
client.connected = true
client.ready = false
client.emittedEnd = false
@@ -49,22 +52,6 @@ function readyHandler (client) {
debug('readyHandler called %s id %s', client.address, client.connectionId)
client.ready = true
client.cork = () => {
client.pipeline = true
client._stream.cork()
}
client.uncork = () => {
if (client.fireStrings) {
client.writeStrings()
} else {
client.writeBuffers()
}
client.pipeline = false
client.fireStrings = true
// TODO: Consider using next tick here. See https://github.com/NodeRedis/nodeRedis/issues/1033
client._stream.uncork()
}
if (client.selectedDb !== undefined) {
client.internalSendCommand(new Command('select', [client.selectedDb])).catch((err) => {
if (!client.closing) {