Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/middleware/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
const semver = require('semver');

module.exports = options => {
// Node.js >=14.8.0 will set Keep-Alive Header, see https://github.com/nodejs/node/pull/34561
const shouldPatchKeepAliveHeader = semver.lt(process.version, '14.8.0');
// Node.js >=14.8.0 and >= 12.19.0 will set Keep-Alive Header, see https://github.com/nodejs/node/pull/34561
const shouldPatchKeepAliveHeader = !semver.satisfies(process.version, '>=14.8.0 || ^12.19.0');

return async function meta(ctx, next) {
if (options.logging) {
Expand Down
2 changes: 1 addition & 1 deletion lib/egg.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ class EggApplication extends EggCore {
const rundir = this.config.rundir;
const dumpFile = path.join(rundir, `${this.type}_timing_${process.pid}.json`);
fs.writeFileSync(dumpFile, CircularJSON.stringify(json, null, 2));
this.timing.clear();
// only disable, not clear bootstrap timing data.
this.timing.disable();
} catch (err) {
this.coreLogger.warn(`dumpTiming error: ${err.message}`);
Expand Down
6 changes: 3 additions & 3 deletions test/lib/egg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ describe('test/lib/egg.test.js', () => {
assert(json[0].pid === process.pid);
});

it('should disable & clear timing after ready', function* () {
it('should disable timing after ready', function* () {
const json = app.timing.toJSON();
assert(json.length === 0);
const last = json[json.length - 1];
app.timing.start('a');
app.timing.end('a');
const json2 = app.timing.toJSON();
assert(json2.length === 0);
assert(json2[json.length - 1].name === last.name);
});

it('should ignore error when dumpTiming', done => {
Expand Down