-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: remove clear timing && skip keep-alive after 12.19.0 #4497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c071c77
to
76ddf1a
Compare
app/middleware/meta.js
Outdated
// 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('>=14.8.0 || ^12.19.0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
提了个 PR 给 node:nodejs/node#35623
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里有一个隐藏问题(14.8.0 和 12.19.0 有一个 floor 的 bug),但没有完美解。
如果用户设置为 12001,且 Node 是 14.8.0 的话,会出现 2 种情况:
- keep-alive 被同时设置为 2 个值: timeout=12.001, timeout=12
- keep-alive 只被设置为:timeout=12.001
此处选择了后者,因为一般不会设置为非标准值。
lib/egg.js
Outdated
fs.writeFileSync(dumpFile, CircularJSON.stringify(json, null, 2)); | ||
this.timing.clear(); | ||
this.timing.disable(); | ||
setTimeout(() => this.timing.clear(), 3000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这么加不太行,如果 agent 在 serverDidReady 里去读取,很有可能是读不到的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3s 还不够?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要不要考虑加个选项...把内存保留回来
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appserver 启动很多不止 3s 的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那还是改为默认不清理吧,只是 disable 禁止新增
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改了,再看下
b2b6b35
to
5ce9dd3
Compare
5ce9dd3
to
f8dc6c6
Compare
Codecov Report
@@ Coverage Diff @@
## master #4497 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 34 34
Lines 1113 1112 -1
Branches 183 183
=========================================
- Hits 1113 1112 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fix: remove clear timing && skip keep-alive after 12.19.0 (#4497)
Checklist
npm test
passesAffected core subsystem(s)
Description of change