Commit e90cb160 by 宋毅

tj

parent 3db099e1
...@@ -27,7 +27,7 @@ class APIBase { ...@@ -27,7 +27,7 @@ class APIBase {
pobj.actionBody.resultInfo = result; pobj.actionBody.resultInfo = result;
pobj.actionBody.requestId = result.requestId; pobj.actionBody.requestId = result.requestId;
pobj.actionBody.opTitle = "reqPath:" + req.path; pobj.actionBody.opTitle = "reqPath:" + req.path;
this.esUtils.addEsLogs(settings.queuedName + "api-req", pobj); this.esUtils.addEsLogs(settings.queuedName + "api-req", pobj.actionBody);
} }
return result; return result;
} catch (error) { } catch (error) {
...@@ -37,7 +37,7 @@ class APIBase { ...@@ -37,7 +37,7 @@ class APIBase {
pobj.actionBody.requestId = await this.getBusUid("err"); pobj.actionBody.requestId = await this.getBusUid("err");
pobj.actionBody.errorInfo = stackStr; pobj.actionBody.errorInfo = stackStr;
pobj.actionBody.opTitle = ",reqPath:" + req.path; pobj.actionBody.opTitle = ",reqPath:" + req.path;
this.esUtils.addEsLogs(settings.queuedName + "apidoexec-error", pobj); this.esUtils.addEsLogs(settings.queuedName + "apidoexec-error", pobj.actionBody);
return rtnerror; return rtnerror;
} }
} }
......
...@@ -80,10 +80,14 @@ class ConsumerBase { ...@@ -80,10 +80,14 @@ class ConsumerBase {
} }
execResult = await this.subDoConsumer(queuedName, actionBody); execResult = await this.subDoConsumer(queuedName, actionBody);
} catch (error) { } catch (error) {
var stackStr = error.stack ? error.stack : JSON.stringify(error); if (execResult && execResult.status == 1) {
this.errorLogDao.addOpErrorLogs("队列执行execSubDoConsumer存在异常", actionBody, execResult, stackStr, 3); await this.pushSuccessLogDao.addOpSuccessLogs("推送成功", actionBody, execResult);
//日志记录 } else {
console.log(stackStr, ",队列执行execSubDoConsumer存在异常"); var stackStr = error.stack ? error.stack : JSON.stringify(error);
this.errorLogDao.addOpErrorLogs("队列执行execSubDoConsumer存在异常", actionBody, execResult, stackStr, 3);
//日志记录
console.log(stackStr, ",队列执行execSubDoConsumer存在异常");
}
} }
} }
......
...@@ -7,7 +7,7 @@ class DbFactory { ...@@ -7,7 +7,7 @@ class DbFactory {
constructor() { constructor() {
const dbConfig = settings.database(); const dbConfig = settings.database();
dbConfig.reconnect = { dbConfig.reconnect = {
max_retries: 10, max_retries: 20,
onRetry: function (count) { onRetry: function (count) {
console.log("connection lost, trying to reconnect (" + count + ")"); console.log("connection lost, trying to reconnect (" + count + ")");
} }
......
...@@ -25,7 +25,8 @@ class EsUtils { ...@@ -25,7 +25,8 @@ class EsUtils {
messageBody: actionBody.messageBody || "", messageBody: actionBody.messageBody || "",
resultInfo: actionBody.resultInfo || "", resultInfo: actionBody.resultInfo || "",
errorInfo: actionBody.errorInfo || "", errorInfo: actionBody.errorInfo || "",
requestId: actionBody.requestId requestId: actionBody.requestId,
created_at: new Date()
} }
var execResult = await this.execPostEs(queuedName, params, esIndexName); var execResult = await this.execPostEs(queuedName, params, esIndexName);
return execResult; return execResult;
......
...@@ -10,8 +10,8 @@ var ENVINPUT = { ...@@ -10,8 +10,8 @@ var ENVINPUT = {
REDIS_DB: process.env.QUEUE_REDIS_DB, REDIS_DB: process.env.QUEUE_REDIS_DB,
DB_NAME: process.env.QUEUE_DB_NAME, DB_NAME: process.env.QUEUE_DB_NAME,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "test",//运行环境 APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "test",//运行环境
CONSUMER_NAME: process.env.CONSUMER_NAME || "publicLogs.publicLogsConsumer",//消费者名称 CONSUMER_NAME: process.env.CONSUMER_NAME || "publicServiceAllocation.publicConsumer",//消费者名称
QUEUED_NAME: process.env.QUEUED_NAME || "LOGS-SYTXPUBLIC-MSGQ",//队列名称,FAIL-失败队列(队列和失败队列一对存在进行部署) QUEUED_NAME: process.env.QUEUED_NAME || "SYTXPUBLIC-MSGQ",//队列名称,FAIL-失败队列(队列和失败队列一对存在进行部署)
}; };
var settings = { var settings = {
env: ENVINPUT.APP_ENV, env: ENVINPUT.APP_ENV,
...@@ -46,10 +46,12 @@ var settings = { ...@@ -46,10 +46,12 @@ var settings = {
dialect: 'mysql', dialect: 'mysql',
operatorsAliases: false, operatorsAliases: false,
pool: { pool: {
max: 5,
min: 0, min: 0,
acquire: 90000000, max: 50,
idle: 1000000 idle: 30000,//断开连接后,连接实例在连接池保持的时间
acquire: 30000,//请求超时时间
evict: 30000,
handleDisconnects: true
}, },
timezone: '+08:00', timezone: '+08:00',
debug: false, debug: false,
......
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