Skip to content

Commit

Permalink
perf: use Math.floor instead of parseInt
Browse files Browse the repository at this point in the history
  • Loading branch information
whatwewant authored and dead-horse committed Jul 13, 2018
1 parent 67d538e commit e866699
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/middleware/meta.js
Expand Up @@ -16,7 +16,10 @@ module.exports = options => {
// try to support Keep-Alive Header
const server = ctx.app.server;
if (server && server.keepAliveTimeout && server.keepAliveTimeout >= 1000 && ctx.header.connection !== 'close') {
const timeout = parseInt(server.keepAliveTimeout / 1000);
/**
* use Math.floor instead of parseInt. More: https://github.com/eggjs/egg/pull/2702
*/
const timeout = Math.floor(server.keepAliveTimeout / 1000);
ctx.set('keep-alive', `timeout=${timeout}`);
}
};
Expand Down

0 comments on commit e866699

Please sign in to comment.