badmfck-api-server 2.3.2 → 2.3.3
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.
@@ -76,22 +76,18 @@ class MysqlService extends BaseService_1.BaseService {
|
|
76
76
|
setInterval(() => {
|
77
77
|
const now = Date.now();
|
78
78
|
const count = this.transactions.length;
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
try {
|
79
|
+
const removedIDs = [];
|
80
|
+
for (let i of this.transactions) {
|
81
|
+
if (now - i.timestamp > this.maxTransactionWaitTime) {
|
83
82
|
(0, LogService_1.logError)("Release transaction connection due to timeout");
|
84
83
|
i.conn.removeAllListeners();
|
85
|
-
|
84
|
+
i.conn.rollback();
|
86
85
|
i.conn.release();
|
87
86
|
this.storeTransactionAsProblem(i, "Timeout");
|
87
|
+
removedIDs.push(i.id);
|
88
88
|
}
|
89
|
-
|
90
|
-
|
91
|
-
this.storeTransactionAsProblem(i, "Timeout, cant,release");
|
92
|
-
}
|
93
|
-
return false;
|
94
|
-
});
|
89
|
+
}
|
90
|
+
this.transactions = this.transactions.filter(i => !removedIDs.includes(i.id));
|
95
91
|
if (this.debug)
|
96
92
|
console.log("Removed: ", count - this.transactions.length);
|
97
93
|
}, 1000 * 30);
|
@@ -410,7 +406,9 @@ class MysqlService extends BaseService_1.BaseService {
|
|
410
406
|
}
|
411
407
|
if (this.debug)
|
412
408
|
console.log("Store transaction fail report: ", file, trx, message);
|
413
|
-
this.failReportFileStream
|
409
|
+
if (!this.failReportFileStream)
|
410
|
+
this.failReportFileStream = fs_1.default.createWriteStream(file, { flags: 'a' });
|
411
|
+
this.failReportFileStream.write(JSON.stringify({ trx, date, message }) + "\n{'s':'&$5__1AzZa'}\n", err => {
|
414
412
|
if (err)
|
415
413
|
(0, LogService_1.logCrit)("${MysqlService.js}", "Can't write to transaction fail report file");
|
416
414
|
else
|