部分脚本 API 请求增加 timeout=3000,防止 API 请求超时导致进程僵死
This commit is contained in:
@@ -514,7 +514,7 @@ async function plantBeanIndex() {
|
||||
}
|
||||
function readShareCode() {
|
||||
return new Promise(async resolve => {
|
||||
$.get({url: `http://api.turinglabs.net/api/v1/jd/bean/read/${randomCount}/`}, (err, resp, data) => {
|
||||
$.get({url: `http://api.turinglabs.net/api/v1/jd/bean/read/${randomCount}/`, timeout: 3000}, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
@@ -635,7 +635,8 @@ function requestGet(function_id, body = {}) {
|
||||
'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Content-Type': "application/x-www-form-urlencoded"
|
||||
}
|
||||
},
|
||||
timeout: 3000,
|
||||
};
|
||||
$.get(option, (err, resp, data) => {
|
||||
try {
|
||||
@@ -666,7 +667,8 @@ function TotalBean() {
|
||||
"Cookie": cookie,
|
||||
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
|
||||
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
|
||||
}
|
||||
},
|
||||
"timeout": 3000,
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
@@ -729,7 +731,8 @@ function taskUrl(function_id, body) {
|
||||
"Accept-Language": "zh-Hans-CN;q=1,en-CN;q=0.9",
|
||||
"Accept-Encoding": "gzip, deflate, br",
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
},
|
||||
timeout: 3000,
|
||||
}
|
||||
}
|
||||
function getParam(url, name) {
|
||||
|
Reference in New Issue
Block a user