You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Refactor pipelining
This commit is contained in:
@@ -126,7 +126,7 @@ Multi.prototype.exec_transaction = function exec_transaction (callback) {
|
||||
var len = self.queue.length;
|
||||
self.errors = [];
|
||||
self.callback = callback;
|
||||
self._client.cork(len + 2);
|
||||
self._client.cork();
|
||||
self.wants_buffers = new Array(len);
|
||||
pipeline_transaction_command(self, 'multi', []);
|
||||
// Drain queue, callback will catch 'QUEUED' or error
|
||||
@@ -151,7 +151,6 @@ Multi.prototype.exec_transaction = function exec_transaction (callback) {
|
||||
multi_callback(self, err, replies);
|
||||
});
|
||||
self._client.uncork();
|
||||
self._client.writeDefault = self._client.writeStrings;
|
||||
return !self._client.should_buffer;
|
||||
};
|
||||
|
||||
@@ -198,7 +197,7 @@ Multi.prototype.exec = Multi.prototype.EXEC = Multi.prototype.exec_batch = funct
|
||||
return true;
|
||||
}
|
||||
self.results = [];
|
||||
self._client.cork(len);
|
||||
self._client.cork();
|
||||
while (args = self.queue.shift()) {
|
||||
var command = args[0];
|
||||
var cb;
|
||||
@@ -213,9 +212,7 @@ Multi.prototype.exec = Multi.prototype.EXEC = Multi.prototype.exec_batch = funct
|
||||
self._client.internal_send_command(command, args[1], cb);
|
||||
index++;
|
||||
}
|
||||
self.queue = new Queue();
|
||||
self._client.uncork();
|
||||
self._client.writeDefault = self._client.writeStrings;
|
||||
return !self._client.should_buffer;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user