fix(sql): fix connection issues in the sql connection loosing it

This commit is contained in:
2025-12-31 07:54:26 -06:00
parent e8a2ef8b85
commit 56934216f7
6 changed files with 43 additions and 6 deletions

View File

@@ -43,6 +43,10 @@ export const initializeProdPool = async () => {
"server",
`The sql ${dbServer[0].value} is not reachable`
);
closePool()
setTimeout(() => {
initializeProdPool();
}, 2*1000);
return {
success: false,
message: `The sql ${dbServer[0].value} is not reachable`,
@@ -106,7 +110,16 @@ export const initializeProdPool = async () => {
error
)}, "There was an error connecting to the pool."`
);
throw new Error("There was an error closing the sql connection");
closePool()
setTimeout(() => {
initializeProdPool();
}, 2*1000);
return {
success: true,
message: "The sql server connection has been closed",
}
//throw new Error("There was an error closing the sql connection");
}
};
@@ -176,6 +189,7 @@ export async function query(queryToRun: string, name: string) {
"server",
`The sql ${dbServer[0].value} is not connected`
);
return {
success: false,
message: `The sql ${dbServer[0].value} is not not connected`,