badmfck-api-server 3.5.7 → 3.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,7 +95,7 @@ async function Initializer(services) {
95
95
  exports.Initializer = Initializer;
96
96
  class APIService extends BaseService_1.BaseService {
97
97
  static nextLogID = 0;
98
- version = "3.5.6";
98
+ version = "3.5.9";
99
99
  options;
100
100
  monitor = null;
101
101
  started = new Date();
@@ -177,7 +177,7 @@ class MysqlAdapter {
177
177
  const trxid = MysqlAdapter.nextTransactionID++;
178
178
  if (this.options.debug)
179
179
  (0, LogService_1.logDB)("Begin transaction with id ", trxid);
180
- const result = await this.query({ query: "START TRANSACTIONS" }, conn);
180
+ const result = await this.query({ query: "START TRANSACTION" }, conn);
181
181
  const trxRequest = {
182
182
  id: trxid,
183
183
  timestamp: Date.now(),
@@ -185,6 +185,7 @@ class MysqlAdapter {
185
185
  queries: []
186
186
  };
187
187
  if (result.error) {
188
+ (0, LogService_1.logCrit)("Can't start transaction! " + result.error.message);
188
189
  trxRequest.queries.push({ sql: "START TRANSACTION", status: "error" });
189
190
  this.rollbackTransaction(trxRequest);
190
191
  return result;
@@ -508,8 +509,9 @@ class MysqlAdapter {
508
509
  await trx.conn.commit();
509
510
  trx.conn.removeAllListeners();
510
511
  trx.conn.release();
511
- if (!donNotRemove)
512
- this.transactions = this.transactions.filter(i => i.id !== trx.id);
512
+ (0, LogService_1.logDB)("Rollback connection released", trx.conn.threadId);
513
+ if (!donNotRemove && this.transactions)
514
+ this.transactions = this.transactions.filter(i => trx && i && i.id !== trx.id);
513
515
  if (this.options.debug)
514
516
  (0, LogService_1.logDB)("Rollback complete", trx.conn.threadId);
515
517
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "3.5.7",
3
+ "version": "3.5.9",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",