请求失败重试1次,并且保存请求失败的内容便于后续分析
This commit is contained in:
parent
70e39f735c
commit
93bfc6c2cf
@ -74,12 +74,25 @@ async function main() {
|
||||
let now = new Date(requestTimestamp + 8 * 3600 * 1000).toISOString();
|
||||
|
||||
let result = await getApiResult("https://weibo.com/ajax/statuses/hot_band");
|
||||
// console.log("result", result);
|
||||
|
||||
if (result.ok != 1) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), "请求成功,但服务器处理失败。");
|
||||
} else {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), "请求成功,但服务器处理失败,正在重试。");
|
||||
result = await getApiResult("https://weibo.com/ajax/statuses/hot_band");
|
||||
if (result.ok != 1) {
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), "请求成功,但服务器处理失败,保存失败信息。");
|
||||
// ok 不为 1,那么久直接保存便于后续分析,不进行后续处理
|
||||
saveJSON({
|
||||
now: now,
|
||||
fileNameSuffix: `origin-error`,
|
||||
object: result,
|
||||
compress: true,
|
||||
uncompress: false
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log(new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString(), "请求成功");
|
||||
// console.log("result", result);
|
||||
|
||||
/**
|
||||
* 保存原始数据
|
||||
@ -246,6 +259,5 @@ async function main() {
|
||||
data: convert
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
exports.main = main;
|
Loading…
Reference in New Issue
Block a user