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 { ...@@ -97,7 +97,7 @@ class TaskController extends Controller {
ctx.logger.error('submit', err); ctx.logger.error('submit', err);
ctx.status = 200; ctx.status = 200;
if (err.code === 'invalid_param') { if (err.code === 'invalid_param') {
ctx.body = { code: -1, msg: '请求参数有误' }; ctx.body = { code: -1, msg: err.errors[0].message };
return; return;
} }
if (/[a-zA-Z]+/.test(err.message)) { if (/[a-zA-Z]+/.test(err.message)) {
......
...@@ -15,7 +15,7 @@ class PartnerService extends Service { ...@@ -15,7 +15,7 @@ class PartnerService extends Service {
if (notifyUrl && notice !== '1') { if (notifyUrl && notice !== '1') {
const ret = await ctx.curl(notifyUrl, { const ret = await ctx.curl(notifyUrl, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
contentType: 'json', contentType: 'json',
method: 'POST', method: 'POST',
data: { data: {
......
...@@ -32,7 +32,7 @@ class ScriptsService extends Service { ...@@ -32,7 +32,7 @@ class ScriptsService extends Service {
} }
const result = await ctx.curl(baseURL + fetchScriptsUrl, { const result = await ctx.curl(baseURL + fetchScriptsUrl, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -56,7 +56,7 @@ class ScriptsService extends Service { ...@@ -56,7 +56,7 @@ class ScriptsService extends Service {
} }
const result = await ctx.curl(baseURL + fetchOneScriptUrl + '/' + scriptId, { const result = await ctx.curl(baseURL + fetchOneScriptUrl + '/' + scriptId, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -82,7 +82,7 @@ class ScriptsService extends Service { ...@@ -82,7 +82,7 @@ class ScriptsService extends Service {
const result = await ctx.curl(baseURL + fetchParamsInfoUrl, { const result = await ctx.curl(baseURL + fetchParamsInfoUrl, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -97,7 +97,7 @@ class ScriptsService extends Service { ...@@ -97,7 +97,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchHelpUrl }, ctx } = this; const { baseURL, scriptsAPI: { fetchHelpUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchHelpUrl + '/' + scriptId, { const result = await ctx.curl(baseURL + fetchHelpUrl + '/' + scriptId, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -108,7 +108,7 @@ class ScriptsService extends Service { ...@@ -108,7 +108,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchQueryButtonUrl }, ctx } = this; const { baseURL, scriptsAPI: { fetchQueryButtonUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchQueryButtonUrl + '/' + scriptId, { const result = await ctx.curl(baseURL + fetchQueryButtonUrl + '/' + scriptId, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -119,7 +119,7 @@ class ScriptsService extends Service { ...@@ -119,7 +119,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchNoticeUrl }, ctx } = this; const { baseURL, scriptsAPI: { fetchNoticeUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchNoticeUrl + '/' + scriptId, { const result = await ctx.curl(baseURL + fetchNoticeUrl + '/' + scriptId, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -130,7 +130,7 @@ class ScriptsService extends Service { ...@@ -130,7 +130,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchHubSeriptsUrl }, ctx } = this; const { baseURL, scriptsAPI: { fetchHubSeriptsUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchHubSeriptsUrl + '/' + hubId + '/scripts', { const result = await ctx.curl(baseURL + fetchHubSeriptsUrl + '/' + hubId + '/scripts', {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -143,7 +143,7 @@ class ScriptsService extends Service { ...@@ -143,7 +143,7 @@ class ScriptsService extends Service {
const url = `https://api.map.baidu.com/location/ip?ak=3TBenWOhPygtFFazaR5kSibU&ip=${ip}`; const url = `https://api.map.baidu.com/location/ip?ak=3TBenWOhPygtFFazaR5kSibU&ip=${ip}`;
const result = await ctx.curl(url, { const result = await ctx.curl(url, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -158,7 +158,7 @@ class ScriptsService extends Service { ...@@ -158,7 +158,7 @@ class ScriptsService extends Service {
const { baseURL, scriptsAPI: { fetchScriptByCityNameUrl }, ctx } = this; const { baseURL, scriptsAPI: { fetchScriptByCityNameUrl }, ctx } = this;
const result = await ctx.curl(baseURL + fetchScriptByCityNameUrl + '?name=' + encodeURIComponent(name) + '&type=query', { const result = await ctx.curl(baseURL + fetchScriptByCityNameUrl + '?name=' + encodeURIComponent(name) + '&type=query', {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
...@@ -186,7 +186,7 @@ class ScriptsService extends Service { ...@@ -186,7 +186,7 @@ class ScriptsService extends Service {
const { cityListAPI, ctx } = this; const { cityListAPI, ctx } = this;
const result = await ctx.curl(cityListAPI, { const result = await ctx.curl(cityListAPI, {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
contentType: 'json', contentType: 'json',
}); });
......
...@@ -23,7 +23,7 @@ class SignatureService extends Service { ...@@ -23,7 +23,7 @@ class SignatureService extends Service {
url = `${baseURL}${url}`; url = `${baseURL}${url}`;
opts = { opts = {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
...opts, ...opts,
}; };
......
...@@ -19,7 +19,7 @@ class StorageService extends Service { ...@@ -19,7 +19,7 @@ class StorageService extends Service {
url = `${baseURL}${url}`; url = `${baseURL}${url}`;
opts = { opts = {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
...opts, ...opts,
}; };
......
...@@ -18,7 +18,7 @@ class TaskService extends Service { ...@@ -18,7 +18,7 @@ class TaskService extends Service {
url = `${baseURL}${url}`; url = `${baseURL}${url}`;
opts = { opts = {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
...opts, ...opts,
}; };
......
...@@ -16,7 +16,7 @@ class WashDataService extends Service { ...@@ -16,7 +16,7 @@ class WashDataService extends Service {
const washData = await app.curl(washUrl, const washData = await app.curl(washUrl,
{ {
charset: 'utf-8', charset: 'utf-8',
timeout: ['30s', '30s'], timeout: [30000, 30000],
dataType: 'json', dataType: 'json',
data: rawdata, data: rawdata,
method: 'post', 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