refactor(utils/scheduleTick): Await database connection

This commit is contained in:
Linden committed 2022-02-25 17:11:28 +11:00
1 parent 2d28c447ec
commit ec53b3282d
6 files changed
+30 -13

No files matched your search

+8 -6
View File
@@ -8,14 +8,16 @@ const pool = createPool({
typeCast,
});
let serverReady = false;
pool
.query(mysql_transaction_isolation_level)
.then(() => console.log(`^2Database server connection established!^0`))
.then(() => {
console.log(`^2Database server connection established!^0`);
serverReady = true;
})
.catch((e: QueryError) =>
setInterval(
() => console.error(`^3Unable to establish a connection to the database! [${e.code}]\n${e.message}^0`),
5000
)
console.error(`^3Unable to establish a connection to the database! [${e.code}]\n${e.message}^0`)
);
export { pool };
export { pool, serverReady };