update trycatch runtime
This commit is contained in:
parent
4696f155c4
commit
16699e7675
|
|
@ -32,6 +32,20 @@ const checkMultipleRequest = async () => {
|
|||
let allResponse = "";
|
||||
const requests = [
|
||||
//Ebay Systems
|
||||
{
|
||||
url: "https://disti.danielvu.com/api/eBayCustomerLog",
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
loginid: null,
|
||||
Code: code,
|
||||
AccessToken: accessToken,
|
||||
},
|
||||
data: {},
|
||||
name: "Ebay customer",
|
||||
group: "Ebay Systems",
|
||||
},
|
||||
{
|
||||
url: "https://disti.danielvu.com/api/eBayNewItemLog",
|
||||
method: "POST",
|
||||
|
|
@ -908,16 +922,15 @@ const checkMultipleRequest = async () => {
|
|||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
if(name === "Test Log System"){
|
||||
if (name === "Test Log System") {
|
||||
if (stdout !== "") {
|
||||
resolve(stdout);
|
||||
} else {
|
||||
resolve(stderr);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
resolve(stdout);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -938,7 +951,7 @@ const checkMultipleRequest = async () => {
|
|||
return 0;
|
||||
});
|
||||
|
||||
return data
|
||||
return data;
|
||||
};
|
||||
|
||||
const promises = requests.map(async (req, index) => {
|
||||
|
|
@ -1034,7 +1047,7 @@ const checkMultipleRequest = async () => {
|
|||
const stdout = await runExec(req.url, req.group);
|
||||
if (stdout !== "") {
|
||||
let responseDataString = JSON.stringify(stdout, null, 2);
|
||||
allResponse += `${req.name}\n${responseDataString}\n\n`;
|
||||
allResponse += `${req.name}\n${responseDataString}\n\n`;
|
||||
|
||||
if (req.name === "Perthmint") {
|
||||
if (stdout.toString().split("true").length - 1 > 1) {
|
||||
|
|
@ -1056,7 +1069,7 @@ const checkMultipleRequest = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
if(req.group === "Test Log System"){
|
||||
if (req.group === "Test Log System") {
|
||||
report.push({
|
||||
group: req.group,
|
||||
name: req.name,
|
||||
|
|
@ -1065,11 +1078,10 @@ const checkMultipleRequest = async () => {
|
|||
lengthOrData: stdout,
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log(stdout);
|
||||
let responseDataString = JSON.stringify(stdout, null, 2);
|
||||
allResponse += `${req.name}\n${responseDataString}\n\n`;
|
||||
allResponse += `${req.name}\n${responseDataString}\n\n`;
|
||||
report.push({
|
||||
group: req.group,
|
||||
name: req.name,
|
||||
|
|
@ -1083,8 +1095,7 @@ const checkMultipleRequest = async () => {
|
|||
|
||||
await Promise.all(promises);
|
||||
|
||||
let groupName = sortArray(report)[0]
|
||||
?.group;
|
||||
let groupName = sortArray(report)[0]?.group;
|
||||
let no = 0;
|
||||
content += "||:high_voltage:**" + groupName + "**|||\n";
|
||||
sortArray(report).map((u, index) => {
|
||||
|
|
@ -1118,9 +1129,9 @@ const checkMultipleRequest = async () => {
|
|||
|
||||
client.messages.send(params);
|
||||
client.messages.send(params1);
|
||||
report.map((r)=>{
|
||||
allResponse += JSON.stringify(r, null, 2)
|
||||
})
|
||||
report.map((r) => {
|
||||
allResponse += JSON.stringify(r, null, 2);
|
||||
});
|
||||
|
||||
fs.writeFileSync("/home/logs/logSystems.txt", allResponse);
|
||||
console.log(sortArray(report));
|
||||
|
|
|
|||
Loading…
Reference in New Issue