badmfck-api-server 2.3.7 → 2.3.8

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.
@@ -83,7 +83,7 @@ async function Initializer(services) {
83
83
  exports.Initializer = Initializer;
84
84
  class APIService extends BaseService_1.BaseService {
85
85
  static nextLogID = 0;
86
- version = "2.3.7";
86
+ version = "2.3.8";
87
87
  options;
88
88
  monitor;
89
89
  monitorIndexFile;
@@ -156,12 +156,11 @@ class MysqlService extends BaseService_1.BaseService {
156
156
  console.log("Begin transaction with id ", tid);
157
157
  try {
158
158
  await conn.query("START TRANSACTION");
159
- const res = await conn.query("SET autocommit=0");
160
159
  if (this.debug)
161
- console.log("Transaction started, SET autocommit=0 ", tid, res);
160
+ console.log("Transaction started");
162
161
  }
163
162
  catch (e) {
164
- this.rollbackTransaction({ id: tid, conn: conn, timestamp: Date.now(), queries: [{ sql: "SET autocommit=0", status: "error" }] });
163
+ this.rollbackTransaction({ id: tid, conn: conn, timestamp: Date.now(), queries: [{ sql: "START TRANSACTION", status: "error" }] });
165
164
  return this.createMysqlQueryError(e);
166
165
  }
167
166
  this.transactions.push({
@@ -256,7 +255,7 @@ class MysqlService extends BaseService_1.BaseService {
256
255
  };
257
256
  let income = [];
258
257
  try {
259
- await conn.query("START TRANSACTION; SET autocommit=0");
258
+ await conn.query("START TRANSACTION");
260
259
  }
261
260
  catch (e) {
262
261
  const err = this.createMysqlQueryError(e);
@@ -288,7 +287,7 @@ class MysqlService extends BaseService_1.BaseService {
288
287
  }
289
288
  async commit(trx) {
290
289
  try {
291
- await trx.conn.query("COMMIT");
290
+ await trx.conn.commit();
292
291
  trx.conn.removeAllListeners();
293
292
  trx.conn.release();
294
293
  }
@@ -302,7 +301,8 @@ class MysqlService extends BaseService_1.BaseService {
302
301
  let err = null;
303
302
  try {
304
303
  console.log("Rollback started", trx.conn);
305
- await trx.conn.query("ROLLBACK");
304
+ await trx.conn.rollback();
305
+ await trx.conn.commit();
306
306
  trx.conn.removeAllListeners();
307
307
  trx.conn.release();
308
308
  if (!donNotRemove)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "2.3.7",
3
+ "version": "2.3.8",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",