@@ -869,14 +869,9 @@ RedisClient.prototype.end = function (flush) {
869
869
return this . stream . destroySoon ( ) ;
870
870
} ;
871
871
872
- function Multi ( client , args , transaction ) {
873
- client . stream . cork ( ) ;
872
+ function Multi ( client , args ) {
874
873
this . _client = client ;
875
874
this . queue = new Queue ( ) ;
876
- if ( transaction ) {
877
- this . exec = this . exec_transaction ;
878
- this . EXEC = this . exec_transaction ;
879
- }
880
875
var command , tmp_args ;
881
876
if ( Array . isArray ( args ) ) {
882
877
while ( tmp_args = args . shift ( ) ) {
@@ -892,11 +887,13 @@ function Multi(client, args, transaction) {
892
887
}
893
888
894
889
RedisClient . 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 ;
896
893
} ;
897
894
898
895
RedisClient . prototype . batch = RedisClient . prototype . BATCH = function ( args ) {
899
- return new Multi ( this , args , false ) ;
896
+ return new Multi ( this , args ) ;
900
897
} ;
901
898
902
899
commands . forEach ( function ( fullCommand ) {
@@ -1077,6 +1074,7 @@ Multi.prototype.exec_transaction = function (callback) {
1077
1074
var cb ;
1078
1075
this . errors = [ ] ;
1079
1076
this . callback = callback ;
1077
+ this . _client . stream . cork ( ) ;
1080
1078
this . _client . pipeline = len + 2 ;
1081
1079
this . wants_buffers = new Array ( len ) ;
1082
1080
this . send_command ( 'multi' , [ ] ) ;
@@ -1194,6 +1192,7 @@ Multi.prototype.exec = Multi.prototype.EXEC = Multi.prototype.exec_batch = funct
1194
1192
return true ;
1195
1193
}
1196
1194
this . results = new Array ( len ) ;
1195
+ this . _client . stream . cork ( ) ;
1197
1196
this . _client . pipeline = len ;
1198
1197
var lastCallback = function ( cb ) {
1199
1198
return function ( err , res ) {
0 commit comments