Skip to content

Commit

Permalink
chore(webso): use config.cpuLimit
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyoukun committed May 29, 2018
1 parent 8db323a commit eb00c5f
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions bin/proxy/http.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,28 +754,17 @@ function doRoute(req, res) {
}

// webso柔性
if (global.cpuUsed > 80) {

if (global.cpuUsed > config.cpuLimit) {
if (httpUtil.isFromWns(req) && req.headers['if-none-match']) {

logger.debug('webso limit 304, cpuUsed: ${cpuUsed}', {
cpuUsed: global.cpuUsed
});

logger.debug(`webso limit 304, cpuUsed: ${global.cpuUsed}, cpuLimit: ${config.cpuLimit}`);
tnm2.Attr_API('SUM_TSW_WEBSO_LIMIT', 1);
try {
res.writeHead(304, {
'Content-Type': 'text/html; charset=UTF-8',
'Etag': req.headers['if-none-match']
});
res.end();
} catch (e) {
logger.info(`response 304 fail ${e.message}`);
}

res.writeHead(304, {
'Content-Type': 'text/html; charset=UTF-8',
'Etag': req.headers['if-none-match']
});
res.end();
return;
}

}

const contentType = req.headers['content-type'] || 'application/x-www-form-urlencoded';
Expand Down

0 comments on commit eb00c5f

Please sign in to comment.