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

@@ -88,7 +88,6 @@ function execTransaction (multi) {
}
const len = queue.length
multi.errors = []
client.cork()
client._multi = true
multi.wantsBuffers = new Array(len)
// Silently ignore this error. We'll receive the error for the exec as well
@@ -100,7 +99,6 @@ function execTransaction (multi) {
}
const main = client.internalSendCommand(new Command('exec', []))
client.uncork()
return Promise.all(promises).then(() => main.then((replies) => multiCallback(multi, replies)).catch((err) => {
err.errors = multi.errors
return Promise.reject(err)
@@ -125,7 +123,6 @@ function execBatch (multi) {
})
}
var error = false
client.cork()
const promises = []
while (queue.length) {
const command = queue.shift()
@@ -134,7 +131,6 @@ function execBatch (multi) {
return e
}))
}
client.uncork()
return Promise.all(promises).then((res) => {
if (error) {
const err = new Errors.RedisError('bla failed')