部分脚本 API 请求增加 timeout=3000,防止 API 请求超时导致进程僵死
This commit is contained in:
@@ -503,7 +503,8 @@ function queryVkComponent() {
|
||||
"Host": `api.m.jd.com`,
|
||||
"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"),
|
||||
"Accept-Language": `zh-Hans-CN;q=1, en-CN;q=0.9`,
|
||||
}
|
||||
},
|
||||
"timeout": 3000,
|
||||
}
|
||||
$.post(options, (err, resp, data) => {
|
||||
try {
|
||||
@@ -621,7 +622,7 @@ function jdfactory_getHomeData() {
|
||||
function readShareCode() {
|
||||
console.log(`开始`)
|
||||
return new Promise(async resolve => {
|
||||
$.get({url: `http://api.turinglabs.net/api/v1/jd/ddfactory/read/${randomCount}/`}, (err, resp, data) => {
|
||||
$.get({url: `http://api.turinglabs.net/api/v1/jd/ddfactory/read/${randomCount}/`, timeout: 3000}, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${JSON.stringify(err)}`)
|
||||
@@ -695,7 +696,8 @@ function taskPostUrl(function_id, body = {}, function_id2) {
|
||||
"referer": "https://h5.m.jd.com/",
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
"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,
|
||||
}
|
||||
}
|
||||
function TotalBean() {
|
||||
@@ -711,7 +713,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 {
|
||||
|
Reference in New Issue
Block a user