-
Notifications
You must be signed in to change notification settings - Fork 37
feat: [BREAKING_CHANGE] check the status of app when start on daemon #9
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
1. check whether stderr contains log 1. check starting time, the maximum is 300s 1. wait app start and exit
lib/cmd/start.js
Outdated
}; | ||
|
||
this.logger.info(`starting egg application at ${baseDir}`); | ||
this.logger.info(`Starting egg application at ${baseDir}`); |
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.
哈,我之前觉得大写不好看,特意改为小写的。
lib/cmd/start.js
Outdated
while (true) { | ||
const stat = yield fs.stat(stderr); | ||
if (stat && stat.size > 0) { | ||
const [ stdout ] = yield exec('tail -n 100 ' + stderr); |
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.
start 之前是支持 win 的,这样改后就不支持了吧?
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.
话说,换个思路的话,master 有错误的时候, emit 一个 message 给 parent ?
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.
这个不是功能性的,是体验优化。可以在部署日志里面大致看到错误,而不用上服务器看日志。
master 也没有 app 和 agent 的错误,不知道是谁打的。
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.
这里不是会 kill master 么? 不仅仅是体验优化了吧?
lib/cmd/start.js
Outdated
const [ stdout ] = yield exec('tail -n 100 ' + stderr); | ||
this.logger.error(stdout); | ||
this.logger.error('Start failed, see %s', stderr); | ||
this.child.kill('SIGTERM'); |
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.
master 只要有 error 日志,就 kill 掉?
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.
对,不能打到 stderr 里
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.
warning 日志是在 stdout 吧?
v8 debug 的那个启动日志好像是会跑去 stderr 的,不过应该不会用这个来 debug
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.
console.warn 到时到 stderr 的
lib/cmd/start.js
Outdated
if (this.isReady) return; | ||
|
||
if (count >= timeout) { | ||
// 启动超时,提示查看 chair-web.log 日志 |
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.
en
Codecov Report
@@ Coverage Diff @@
## master #9 +/- ##
==========================================
+ Coverage 97.7% 98.78% +1.07%
==========================================
Files 6 6
Lines 131 165 +34
==========================================
+ Hits 128 163 +35
+ Misses 3 2 -1
Continue to review full report at Codecov.
|
@atian25 还有哪些要改的 |
README 不是写着 windows 不支持吗 |
starting 的时候最好能取到 framework 的名字 |
不是有 getFramework 了么? 读下 package.json 然后 print 下?
只是写着 stop 不支持吧? 如果 start 也不支持的话,README 和 egg docs 都要改下。 +1 |
@atian25 这个需要发 break 吗 |
deploy tool for egg project. | ||
|
||
**Note: Windows is not supported** | ||
|
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.
算不算 break?之前好像有人在 win 使用。
lib/cmd/start.js
Outdated
// nothing | ||
} | ||
if (stat && stat.size > 0) { | ||
const [ stdout ] = yield exec('tail -n 100 ' + stderr); |
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.
要不然这里兼容下,win 打个 warning 提示不再兼容,跳过这段逻辑
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.
那我把这里去掉吧
}); | ||
|
||
// check start status | ||
yield this.checkStatus(argv); |
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.
这里直接用 getRotatelog(argv.stderr)
返回的流?就不用读文件了?
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.
哪里读文件了?
那问题可以合并了 |
lib/cmd/start.js
Outdated
timeout: { | ||
description: 'a timeout for start when daemon', | ||
type: 'number', | ||
default: 300, |
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.
改为 ms 符合直觉一点吧? 下面自己除掉.
其他 OK,可以合并
改了 |
你发 major 吧,然后 egg docs 那边也要改下 |
|
Checklist
npm test
passesAffected core subsystem(s)
Description of change