Commit 369c5e39 authored by 姜登's avatar 姜登

timeout

parent 3eec0c37
Pipeline #5870 passed with stage
in 2 seconds
......@@ -97,7 +97,7 @@ class TaskController extends Controller {
ctx.logger.error('submit', err);
ctx.status = 200;
if (err.code === 'invalid_param') {
ctx.body = { code: -1, msg: '请求参数有误' };
ctx.body = { code: -1, msg: err.errors[0].message };
return;
}
if (/[a-zA-Z]+/.test(err.message)) {
......
......@@ -15,7 +15,7 @@ class PartnerService extends Service {
if (notifyUrl && notice !== '1') {
const ret = await ctx.curl(notifyUrl, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
contentType: 'json',
method: 'POST',
data: {
......
......@@ -32,7 +32,7 @@ class ScriptsService extends Service {
}
const result = await ctx.curl(baseURL + fetchScriptsUrl, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -56,7 +56,7 @@ class ScriptsService extends Service {
}
const result = await ctx.curl(baseURL + fetchOneScriptUrl + '/' + scriptId, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -82,7 +82,7 @@ class ScriptsService extends Service {
const result = await ctx.curl(baseURL + fetchParamsInfoUrl, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -97,7 +97,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchHelpUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchHelpUrl + '/' + scriptId, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -108,7 +108,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchQueryButtonUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchQueryButtonUrl + '/' + scriptId, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -119,7 +119,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchNoticeUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchNoticeUrl + '/' + scriptId, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -130,7 +130,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchHubSeriptsUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchHubSeriptsUrl + '/' + hubId + '/scripts', {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -143,7 +143,7 @@ class ScriptsService extends Service {
const url = `https://api.map.baidu.com/location/ip?ak=3TBenWOhPygtFFazaR5kSibU&ip=${ip}`;
const result = await ctx.curl(url, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -158,7 +158,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchScriptByCityNameUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchScriptByCityNameUrl + '?name=' + encodeURIComponent(name) + '&type=query', {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......@@ -186,7 +186,7 @@ class ScriptsService extends Service {
const { cityListAPI, ctx } = this;
const result = await ctx.curl(cityListAPI, {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
......
......@@ -23,7 +23,7 @@ class SignatureService extends Service {
url = `${baseURL}${url}`;
opts = {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
...opts,
};
......
......@@ -19,7 +19,7 @@ class StorageService extends Service {
url = `${baseURL}${url}`;
opts = {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
...opts,
};
......
......@@ -18,7 +18,7 @@ class TaskService extends Service {
url = `${baseURL}${url}`;
opts = {
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
...opts,
};
......
......@@ -16,7 +16,7 @@ class WashDataService extends Service {
const washData = await app.curl(washUrl,
{
charset: 'utf-8',
timeout: ['30s', '30s'],
timeout: [30000, 30000],
dataType: 'json',
data: rawdata,
method: 'post',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment