badmfck-api-server 2.2.7 → 2.2.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.2.7";
86
+ version = "2.2.9";
87
87
  options;
88
88
  monitor;
89
89
  monitorIndexFile;
@@ -206,7 +206,7 @@ class MysqlService extends BaseService_1.BaseService {
206
206
  };
207
207
  exports.REQ_MYSQL_TROLLBACK.listener = async (tid) => {
208
208
  const trx = this.transactions.find(i => i.id === tid);
209
- if (!trx)
209
+ if (!trx) {
210
210
  return {
211
211
  code: "NO_TRX",
212
212
  errno: 100004,
@@ -215,11 +215,13 @@ class MysqlService extends BaseService_1.BaseService {
215
215
  name: "NO_TRX",
216
216
  message: "Transaction not found"
217
217
  };
218
+ }
218
219
  this.transactions = this.transactions.filter(i => i.id !== tid);
219
220
  try {
220
221
  await trx.conn.rollback();
221
222
  trx.conn.removeAllListeners();
222
223
  trx.conn.release();
224
+ trx.conn.end();
223
225
  }
224
226
  catch (e) {
225
227
  (0, LogService_1.logError)("Can't rollback transaction");
@@ -586,6 +588,12 @@ class MysqlService extends BaseService_1.BaseService {
586
588
  });
587
589
  return;
588
590
  }
591
+ for (let i of this.transactions) {
592
+ if (i.conn === conn) {
593
+ (0, LogService_1.logInfo)("Your connection is in transaction");
594
+ break;
595
+ }
596
+ }
589
597
  this.sendQuery(conn, query, resolve, rollbackQuery);
590
598
  }
591
599
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "badmfck-api-server",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "description": "Simple API http server based on express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",