feat: supports serialization of options#97
Conversation
Codecov Report
@@ Coverage Diff @@
## master #97 +/- ##
==========================================
+ Coverage 98.82% 98.83% +0.01%
==========================================
Files 8 8
Lines 511 517 +6
==========================================
+ Hits 505 511 +6
Misses 6 6 Continue to review full report at Codecov.
|
96f73a0 to
23fc7b3
Compare
|
另,是否需要在 debug 模式时默认设置为 |
120bebe to
0eba33b
Compare
0eba33b to
e9d9069
Compare
e9d9069 to
9d9f33a
Compare
| | require | `Array\|String` | will inject into worker/agent process | | ||
| | pidFile | `String` | will save master pid to this file | | ||
| | [serialization] | `json|advanced` | default: 'json'. 'advanced' requires Node.js >= 10.16.0 | | ||
|
|
There was a problem hiding this comment.
另,是否需要在 debug 模式时默认设置为
advanced值?
或者当 >= 12.16.0 时全部默认 'advanced'?我看了下下面的相关讨论:nodejs/node#30162 (comment), 看起来
advanced并不是所有场景下都是最优解,所以这里确实应该 follow 上游的设置,默认为 'json',但是在框架里在适当的版本暴露可配置选项。
我也是如此考虑:随着版本更新性能提升及可靠性得到进一步验证,可能在未来某个版本默认改为 advanced。
所以跟随 node.js 默认设置(json),代码里面不做默认值设置,让有需要的用户自行决定传入参数控制。
| if (this.options.isDebug) opt.execArgv = process.execArgv.concat([ `--${semver.gte(process.version, '8.0.0') ? 'inspect' : 'debug'}-port=${debugPort}` ]); | ||
|
|
||
| /* istanbul ignore next */ | ||
| if (semver.gte(process.version, '12.16.0')) { |
There was a problem hiding this comment.
这里的判断有一个问题,'v13.0.0' 也是 >= 12.16.0,但是这个版本 patch 了此功能么
There was a problem hiding this comment.
对于 12 版本是 >= 12.16.0, 对于 13 版本是 >= 13.2.0。
代码已更新判断条件。
hyj1991
left a comment
There was a problem hiding this comment.
感谢您关于 v12.16.0 更新的支持更多 IPC 序列/反序列化的配置参数 PR,以上是我的一些对于 PR 代码的修改建议,期望可以一起针对修改/不修改的合理性进行讨论 :)
我看了下下面的相关讨论:nodejs/node#30162 (comment), 看起来 |
|
如果这个未来还会变化的话,那目前能否先通过 NODE_OPTIONS ENV 的方式来使用就好了? |
>= v12.16.0 < v13.0.0, or >= v13.2.0
4179e83 to
1249d64
Compare
这个变量设置是否影响 forkAgentWorker() 对 agent 进程的派生。 |
影响的,fork 默认是继承 env 的。可以试验下 |
就是说不修改代码,通过设置 ENV 也能起效果。那我关闭这个 PR 了哟? |
我理解是这样的,你实验下看看 |
那我测试下。 |
|
所以这个 PR 还有下文不。。。 |
么时间测试啊,我先关掉。 |
ref: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V12.md#advanced-serialization-for-ipc
Checklist
npm testpassesAffected core subsystem(s)
Description of change