@@ -30,15 +30,10 @@ var handleConnectionFailure = function (api, connection, actionTemplate, error,
30
30
} ;
31
31
32
32
// 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 ) ;
37
35
} else {
38
36
callback ( error ) ;
39
- // connection.dbConnectionMap[databaseName].disconnect();
40
- // connection.error = error;
41
- // next(connection, false);
42
37
}
43
38
} ) ;
44
39
} ;
@@ -102,7 +97,6 @@ exports.transaction = function (api, next) {
102
97
// Begin transaction
103
98
dbConnectionMap [ databaseName ] . beginTransaction ( callback ) ;
104
99
} else {
105
- // next(connection, true);
106
100
callback ( ) ;
107
101
}
108
102
}
@@ -148,11 +142,9 @@ exports.transaction = function (api, next) {
148
142
} ;
149
143
150
144
// if the action is transactional, end the transaction
151
- if ( actionTemplate . transaction === "write" ) {
145
+ if ( actionTemplate . transaction === "write" && connection . dbConnectionMap [ databaseName ] . isConnected ( ) ) {
152
146
connection . dbConnectionMap [ databaseName ] . endTransaction ( connection . response . error , callback ) ;
153
147
} else {
154
- // connection.dbConnectionMap[databaseName].disconnect();
155
- // next(connection);
156
148
callback ( ) ;
157
149
}
158
150
} ) ;
0 commit comments