Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit b0c3eb5

Browse files
committed
Merge pull request #408 from cloudspokes/SUP-214-api-stability
API stability fixes per SUP-214
2 parents cc77fe5 + 365c7dd commit b0c3eb5

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

initializers/dataAccess.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ exports.dataAccess = function (api, next) {
270270
api.log('Finish executing ' + f, 'debug');
271271
}
272272
}).execute();
273-
}
273+
} else cb("Connection closed unexpectedly");
274274
}
275275
], function (err, result) {
276276
if (err) {
@@ -340,7 +340,7 @@ exports.dataAccess = function (api, next) {
340340
api.log('Finish executing ' + f, 'debug');
341341
}
342342
}).execute();
343-
}
343+
} else cb("Connection closed unexpectedly");
344344
}
345345
], function (err, result) {
346346
if (err) {

initializers/transaction.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
});

queries/get_rounds_for_problem

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ SELECT
22
r.round_id,
33
r.name AS round_name,
44
r.contest_id,
5-
(SELECT name FROM contest c WHERE c.contest_id = r.contest_id) AS contest_name,
6-
r.editorial_link
5+
(SELECT name FROM contest c WHERE c.contest_id = r.contest_id) AS contest_name
76
FROM
87
problem p
98
INNER JOIN component c ON c.problem_id = p.problem_id

0 commit comments

Comments
 (0)