|
|
@ -1,8 +1,9 @@
|
|
|
|
const fs = require("fs");
|
|
|
|
const fs = require("fs");
|
|
|
|
const {sleep} = require("../src/util");
|
|
|
|
const { sleep } = require("../src/util");
|
|
|
|
const {R} = require("redbean-node");
|
|
|
|
const { R } = require("redbean-node");
|
|
|
|
const {setSetting, setting} = require("./util-server");
|
|
|
|
const {
|
|
|
|
|
|
|
|
setSetting, setting,
|
|
|
|
|
|
|
|
} = require("./util-server");
|
|
|
|
|
|
|
|
|
|
|
|
class Database {
|
|
|
|
class Database {
|
|
|
|
|
|
|
|
|
|
|
@ -95,11 +96,11 @@ class Database {
|
|
|
|
const listener = (reason, p) => {
|
|
|
|
const listener = (reason, p) => {
|
|
|
|
Database.noReject = false;
|
|
|
|
Database.noReject = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
process.addListener('unhandledRejection', listener);
|
|
|
|
process.addListener("unhandledRejection", listener);
|
|
|
|
|
|
|
|
|
|
|
|
console.log("Closing DB")
|
|
|
|
console.log("Closing DB")
|
|
|
|
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
for (;;) {
|
|
|
|
Database.noReject = true;
|
|
|
|
Database.noReject = true;
|
|
|
|
await R.close()
|
|
|
|
await R.close()
|
|
|
|
await sleep(2000)
|
|
|
|
await sleep(2000)
|
|
|
@ -112,7 +113,7 @@ class Database {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log("SQLite closed")
|
|
|
|
console.log("SQLite closed")
|
|
|
|
|
|
|
|
|
|
|
|
process.removeListener('unhandledRejection', listener);
|
|
|
|
process.removeListener("unhandledRejection", listener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|