Skip to content

Commit 285de00

Browse files
authored
Merge pull request #164 from Tencent/dev
Release 1.1.5
2 parents 8813ad1 + 3de60dc commit 285de00

File tree

27 files changed

+528
-172
lines changed

27 files changed

+528
-172
lines changed

.eslintrc.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,26 @@
112112
],
113113
"strict": [
114114
"off"
115+
],
116+
"new-cap": [
117+
"off"
115118
]
116119
},
117120
"overrides": [
121+
{
122+
"files": ["bin/**/*Jce.js"],
123+
"rules": {
124+
"no-var": [
125+
"off"
126+
],
127+
"no-unused-vars": [
128+
"off"
129+
],
130+
"no-use-before-define": [
131+
"off"
132+
]
133+
}
134+
},
118135
{
119136
"files": ["bin/tsw/wwwroot/*.js"],
120137
"env": {
@@ -131,7 +148,7 @@
131148
]
132149
}
133150
}, {
134-
"files": ["bin/lib/util/mail/tmpl.js", "bin/tsw/util/**/tmpl.js"],
151+
"files": ["bin/**/tmpl.js"],
135152
"rules": {
136153
"no-unused-vars": [
137154
"error",

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ language: node_js
33
node_js:
44
- "8"
55
- "9"
6+
- "10.5.0"
67

78
script:
89
- commitlint-travis

bin/proxy/http.proxy.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ process.on('message', function(message) {
8787
return;
8888
}
8989

90-
logger.info(`cpu: ${serverInfo.cpu} ${message.cmd}`);
90+
logger.info(`receive message, cmd: ${message.cmd}`);
9191
methodMap[message.cmd](message);
9292
});
9393

@@ -251,8 +251,7 @@ function listen(cpu) {
251251

252252
const finish = function() {
253253

254-
// 开始发送心跳
255-
logger.info('start heart beat');
254+
logger.info('start heartbeat');
256255

257256
startHeartBeat();
258257

@@ -268,11 +267,13 @@ function listen(cpu) {
268267
uid: user_00
269268
});
270269
}
270+
271271
websocket.start_listen();
272272

273273
logger.info('cpu: ${cpu}, afterStartup...', serverInfo);
274274

275275
if (typeof config.afterStartup === 'function') {
276+
logger.info('cpu: ${cpu}, config.afterStartup fired', serverInfo);
276277
config.afterStartup(serverInfo.cpu);
277278
}
278279
};
@@ -356,18 +357,16 @@ function heartBeat() {
356357
}
357358

358359
global.cpuUsed = cpuUtil.getCpuUsed(serverInfo.cpu);
360+
359361
if (global.cpuUsed >= 80) {
360362
global.cpuUsed80 = ~~global.cpuUsed80 + 1;
361363
} else {
362364
global.cpuUsed80 = 0;
363365
}
364366

365-
const cpuUsed = global.cpuUsed;
366-
tnm2.Attr_API_Set('AVG_TSW_CPU_USED', cpuUsed);
367-
368367
// 高负载告警
369368
if (global.cpuUsed80 === 4 && !config.isTest && !isWin32Like) {
370-
afterCpu80(cpuUsed);
369+
afterCpu80(global.cpuUsed);
371370
}
372371

373372
const currMemory = process.memoryUsage();

bin/proxy/http.route.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,10 @@ function doRoute(req, res) {
481481
};
482482
})(res.writeHead);
483483

484-
const mod_act = contextMod.currentContext().mod_act || httpModAct.getModAct(req);
484+
let mod_act = contextMod.currentContext().mod_act || httpModAct.getModAct(req);
485+
if (typeof mod_act !== 'string' || !mod_act) {
486+
mod_act = null;
487+
}
485488
contextMod.currentContext().mod_act = mod_act;
486489

487490
if (alpha.isAlpha(req)) {
@@ -606,7 +609,7 @@ function doRoute(req, res) {
606609

607610
dcapi.report({
608611
key: 'EVENT_TSW_HTTP_IP_BLOCK',
609-
toIp: clientIp || '127.0.0.1',
612+
toIp: clientIp,
610613
code: 0,
611614
isFail: 0,
612615
delay: 100

0 commit comments

Comments
 (0)