mirror of
https://github.com/darksaid98/oxmysql.git
synced 2026-12-03 22:20:56 +00:00
fix(db/connection): don't establish connection from getPoolConnection
Should prevent connection timeouts when queries are called during server startup.
This commit is contained in:
1 parent
0f5f397814
commit
3fef918000
1 file changed
+2
-6
@@ -13,7 +13,7 @@ export async function waitForConnection() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createConnectionPool() {
|
export async function createConnectionPool() {
|
||||||
try {
|
try {
|
||||||
pool = createPool(connectionOptions);
|
pool = createPool(connectionOptions);
|
||||||
|
|
||||||
@@ -39,11 +39,7 @@ async function createConnectionPool() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getPoolConnection() {
|
export async function getPoolConnection() {
|
||||||
if (!pool) {
|
if (!isServerConnected) await waitForConnection()
|
||||||
await createConnectionPool();
|
|
||||||
|
|
||||||
if (!pool) return;
|
|
||||||
}
|
|
||||||
|
|
||||||
scheduleTick();
|
scheduleTick();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user