@@ -30,15 +30,10 @@ var handleConnectionFailure = function (api, connection, actionTemplate, error,
3030 } ;
3131
3232 // if the action is transactional, end the transaction
33- if ( actionTemplate . transaction === "write" ) {
34- if ( connection . dbConnectionMap [ databaseName ] . isConnected ( ) ) {
35- connection . dbConnectionMap [ databaseName ] . endTransaction ( error , callback ) ;
36- }
33+ if ( actionTemplate . transaction === "write" && connection . dbConnectionMap [ databaseName ] . isConnected ( ) ) {
34+ connection . dbConnectionMap [ databaseName ] . endTransaction ( error , callback ) ;
3735 } else {
3836 callback ( error ) ;
39- // connection.dbConnectionMap[databaseName].disconnect();
40- // connection.error = error;
41- // next(connection, false);
4237 }
4338 } ) ;
4439} ;
@@ -102,7 +97,6 @@ exports.transaction = function (api, next) {
10297 // Begin transaction
10398 dbConnectionMap [ databaseName ] . beginTransaction ( callback ) ;
10499 } else {
105- // next(connection, true);
106100 callback ( ) ;
107101 }
108102 }
@@ -148,11 +142,9 @@ exports.transaction = function (api, next) {
148142 } ;
149143
150144 // if the action is transactional, end the transaction
151- if ( actionTemplate . transaction === "write" ) {
145+ if ( actionTemplate . transaction === "write" && connection . dbConnectionMap [ databaseName ] . isConnected ( ) ) {
152146 connection . dbConnectionMap [ databaseName ] . endTransaction ( connection . response . error , callback ) ;
153147 } else {
154- // connection.dbConnectionMap[databaseName].disconnect();
155- // next(connection);
156148 callback ( ) ;
157149 }
158150 } ) ;
0 commit comments