hotband 请求失败不保存 origin-error 目录下 .json 文件
This commit is contained in:
@@ -18,12 +18,20 @@ async function main() {
|
||||
let now = new Date(requestTimestamp + 8 * 3600 * 1000).toISOString();
|
||||
|
||||
let result = await requestUtils.getApiResult(API_URL);
|
||||
if (result === undefined) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求失败");
|
||||
return;
|
||||
}
|
||||
if (result.code != 0) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求成功,但服务器处理失败,等待3s后重试。");
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 3000); // 等待3秒
|
||||
});
|
||||
result = await requestUtils.getApiResult(API_URL);
|
||||
if (result === undefined) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "重试请求失败");
|
||||
return;
|
||||
}
|
||||
if (result.ok != 1) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求成功,但服务器处理失败,保存失败信息。");
|
||||
// ok 不为 1,那么久直接保存便于后续分析,不进行后续处理
|
||||
|
@@ -18,12 +18,20 @@ async function main() {
|
||||
let now = new Date(requestTimestamp + 8 * 3600 * 1000).toISOString();
|
||||
|
||||
let result = await requestUtils.getApiResult(API_URL);
|
||||
if (result === undefined) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求失败");
|
||||
return;
|
||||
}
|
||||
if (result.code != 0) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求成功,但服务器处理失败,等待3s后重试。");
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 3000); // 等待3秒
|
||||
});
|
||||
result = await requestUtils.getApiResult(API_URL);
|
||||
if (result === undefined) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "重试请求失败");
|
||||
return;
|
||||
}
|
||||
if (result.ok != 1) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求成功,但服务器处理失败,保存失败信息。");
|
||||
// ok 不为 1,那么久直接保存便于后续分析,不进行后续处理
|
||||
|
@@ -18,12 +18,20 @@ async function main() {
|
||||
let now = new Date(requestTimestamp + 8 * 3600 * 1000).toISOString();
|
||||
|
||||
let result = await requestUtils.getApiResult(API_URL);
|
||||
if (result === undefined) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求失败");
|
||||
return;
|
||||
}
|
||||
if (result.ok != 1) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求成功,但服务器处理失败,等待3s后重试。");
|
||||
await new Promise((resolve) => {
|
||||
setTimeout(resolve, 3000); // 等待3秒
|
||||
});
|
||||
result = await requestUtils.getApiResult(API_URL);
|
||||
if (result === undefined) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "重试请求失败");
|
||||
return;
|
||||
}
|
||||
if (result.ok != 1) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), SUB_FOLDER, "请求成功,但服务器处理失败,保存失败信息。");
|
||||
// ok 不为 1,那么就直接保存便于后续分析,不进行后续处理
|
||||
|
@@ -14,7 +14,7 @@ async function getApiResult(url) {
|
||||
} else {
|
||||
// 请求失败
|
||||
console.log(`error is ${error}`);
|
||||
resolve({});
|
||||
resolve(undefined);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user