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