Commit e90cb160 by 宋毅

tj

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