mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-02 22:22:50 +00:00
refactor(utils/scheduleTick): Await database connection
This commit is contained in:
1 parent
2d28c447ec
commit
ec53b3282d
6 files changed
+30
-13
No files matched your search
@@ -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 };
|
||||
Reference in new issue
Block a user