Skip to content

Commit b31b47d

Browse files
authored
feat: clear & disable timing after ready (#4421)
1 parent d25d32e commit b31b47d

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
name: Continuous integration
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches: [ master ]
5+
pull_request:
6+
branches: [ master, 1.x ]
7+
schedule:
8+
- cron: '0 2 * * *'
39
jobs:
410
Runner:
511
runs-on: ${{ matrix.os }}
612
strategy:
13+
fail-fast: false
714
matrix:
8-
os: [ubuntu-latest, macOS-latest]
9-
node-version: [8, 10, 12, 14]
15+
os: [ ubuntu-latest, macOS-latest, windows-latest ]
16+
node-version: [ 8, 10, 12, 14 ]
1017
steps:
1118
- name: Checkout Git Source
1219
uses: actions/checkout@master
20+
1321
- name: Setup Node.js
1422
uses: actions/setup-node@v1
1523
with:
1624
node-version: ${{ matrix.node-version }}
25+
1726
- name: Install Dependencies
18-
run: |
19-
npm install
27+
run: npm i -g npminstall && npminstall
28+
2029
- name: Continuous integration
2130
run: npm run ci
31+
2232
- name: Code Coverage
23-
run: |
24-
npm install codecov -g
25-
codecov
26-
env:
27-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
33+
uses: codecov/codecov-action@v1
34+
with:
35+
token: ${{ secrets.CODECOV_TOKEN }}

appveyor.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

lib/egg.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,8 @@ class EggApplication extends EggCore {
411411
const rundir = this.config.rundir;
412412
const dumpFile = path.join(rundir, `${this.type}_timing_${process.pid}.json`);
413413
fs.writeFileSync(dumpFile, CircularJSON.stringify(json, null, 2));
414+
this.timing.clear();
415+
this.timing.disable();
414416
} catch (err) {
415417
this.coreLogger.warn(`dumpTiming error: ${err.message}`);
416418
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"delegates": "^1.0.0",
2626
"egg-cluster": "^1.23.0",
2727
"egg-cookies": "^2.3.0",
28-
"egg-core": "^4.16.1",
28+
"egg-core": "^4.18.0",
2929
"egg-development": "^2.4.2",
3030
"egg-i18n": "^2.0.0",
3131
"egg-jsonp": "^2.0.0",

test/lib/egg.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ describe('test/lib/egg.test.js', () => {
145145
assert(json[0].pid === process.pid);
146146
});
147147

148+
it('should disable & clear timing after ready', function* () {
149+
const json = app.timing.toJSON();
150+
assert(json.length === 0);
151+
app.timing.start('a');
152+
app.timing.end('a');
153+
const json2 = app.timing.toJSON();
154+
assert(json2.length === 0);
155+
});
156+
148157
it('should ignore error when dumpTiming', done => {
149158
mm(fs, 'writeFileSync', () => {
150159
throw new Error('mock error');

0 commit comments

Comments
 (0)