Commit 0001e155 authored by nanahira's avatar nanahira

fix finalize problem

parent 10a04a9d
......@@ -21,6 +21,9 @@ class DataManager {
this.ready = false;
this.log = log;
}
async finalize() {
await this.db.close();
}
async transaction(fun) {
const runner = await this.db.createQueryRunner();
await runner.connect();
......
......@@ -44,6 +44,9 @@ export class DataManager {
this.ready = false;
this.log = log;
}
async finalize() {
await this.db.close();
}
private async transaction(fun: (mdb: EntityManager) => Promise<boolean>) {
const runner = await this.db.createQueryRunner();
await runner.connect();
......
......@@ -3953,3 +3953,7 @@ if true
return
init()
process.on 'SIGINT', ()->
if this.dataManager
await this.dataManager.finialize()
process.exit(0)
\ No newline at end of file
......@@ -5231,4 +5231,11 @@
init();
process.on('SIGINT', async function() {
if (this.dataManager) {
await this.dataManager.finialize();
return process.exit(0);
}
});
}).call(this);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment