fix(sql): fix connection issues in the sql connection loosing it
This commit is contained in:
@@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{urlv2}}/api/notify/materialperday
|
||||
url: {{urlv2}}/api/notify/toomanyerrors
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
22
LogisticsSupportTool_API_DOCS/LstV2/Warehouse/sscc.bru
Normal file
22
LogisticsSupportTool_API_DOCS/LstV2/Warehouse/sscc.bru
Normal file
@@ -0,0 +1,22 @@
|
||||
meta {
|
||||
name: sscc
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: {{url}}/lst/old/api/logistics/getsscc
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"runningNr": ""
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
@@ -5,11 +5,12 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url:
|
||||
url: {{url}}/lst/api/logistics/getsscc
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
vars {
|
||||
url: https://uslim1prod.alpla.net
|
||||
url: https://day1prod.alpla.net
|
||||
session_cookie:
|
||||
urlv2: http://localhost:3000
|
||||
jwtV2:
|
||||
|
||||
@@ -78,7 +78,7 @@ const main = async () => {
|
||||
|
||||
// connect to the prod sql
|
||||
console.log("Connecting to the sql server");
|
||||
await initializeProdPool();
|
||||
|
||||
|
||||
// express app
|
||||
const app = express();
|
||||
@@ -184,7 +184,7 @@ const main = async () => {
|
||||
// swaggerUi.serve,
|
||||
// swaggerUi.setup(openapiSpec, swaggerUiOptions),
|
||||
// );
|
||||
|
||||
initializeProdPool();
|
||||
setupSwagger(app, basePath)
|
||||
app.use(basePath + "/d", express.static(join(__dirname, "../lstDocs/build")));
|
||||
app.use(
|
||||
|
||||
@@ -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