fix(sql): fix connection issues in the sql connection loosing it
This commit is contained in:
@@ -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`,
|
||||
|
||||
Reference in New Issue
Block a user