@@ -869,14 +869,9 @@ RedisClient.prototype.end = function (flush) {
869869 return this . stream . destroySoon ( ) ;
870870} ;
871871
872- function Multi ( client , args , transaction ) {
873- client . stream . cork ( ) ;
872+ function Multi ( client , args ) {
874873 this . _client = client ;
875874 this . queue = new Queue ( ) ;
876- if ( transaction ) {
877- this . exec = this . exec_transaction ;
878- this . EXEC = this . exec_transaction ;
879- }
880875 var command , tmp_args ;
881876 if ( Array . isArray ( args ) ) {
882877 while ( tmp_args = args . shift ( ) ) {
@@ -892,11 +887,13 @@ function Multi(client, args, transaction) {
892887}
893888
894889RedisClient . prototype . multi = RedisClient . prototype . MULTI = function ( args ) {
895- return new Multi ( this , args , true ) ;
890+ var multi = new Multi ( this , args ) ;
891+ multi . exec = multi . EXEC = multi . exec_transaction ;
892+ return multi ;
896893} ;
897894
898895RedisClient . prototype . batch = RedisClient . prototype . BATCH = function ( args ) {
899- return new Multi ( this , args , false ) ;
896+ return new Multi ( this , args ) ;
900897} ;
901898
902899commands . forEach ( function ( fullCommand ) {
@@ -1077,6 +1074,7 @@ Multi.prototype.exec_transaction = function (callback) {
10771074 var cb ;
10781075 this . errors = [ ] ;
10791076 this . callback = callback ;
1077+ this . _client . stream . cork ( ) ;
10801078 this . _client . pipeline = len + 2 ;
10811079 this . wants_buffers = new Array ( len ) ;
10821080 this . send_command ( 'multi' , [ ] ) ;
@@ -1194,6 +1192,7 @@ Multi.prototype.exec = Multi.prototype.EXEC = Multi.prototype.exec_batch = funct
11941192 return true ;
11951193 }
11961194 this . results = new Array ( len ) ;
1195+ this . _client . stream . cork ( ) ;
11971196 this . _client . pipeline = len ;
11981197 var lastCallback = function ( cb ) {
11991198 return function ( err , res ) {
0 commit comments