Skip to content

Commit f95bf02

Browse files
committed
feat: clear & disable timing after ready
1 parent a7ae46c commit f95bf02

File tree

6 files changed

+35
-35
lines changed

6 files changed

+35
-35
lines changed
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
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
1827
run: |
1928
npm install
29+
2030
- name: Continuous integration
2131
run: npm run ci
32+
2233
- name: Code Coverage
23-
run: |
24-
npm install codecov -g
25-
codecov
26-
env:
27-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
34+
uses: codecov/codecov-action@v1
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}

.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,10 @@ node_js:
1111
- '12'
1212
- '14'
1313
before_install:
14-
- npm install -g npminstall
14+
- npm i npminstall -g
1515
install:
1616
- npminstall
17-
- npminstall codecov
1817
script:
1918
- npm run ci
2019
after_script:
21-
- codecov
22-
- test $TRAVIS_NODE_VERSION = 8 && travis_wait scripts/doc_travis.sh
23-
env:
24-
global:
25-
- ENCRYPTION_LABEL: a62186272189
20+
- npminstall codecov && codecov

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: 5 additions & 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",
@@ -115,5 +115,9 @@
115115
"engines": {
116116
"node": ">= 8.0.0"
117117
},
118+
"ci": {
119+
"type": "travis, github",
120+
"version": "8, 10, 12, 14"
121+
},
118122
"license": "MIT"
119123
}

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)