Skip to content

Conversation

popomore
Copy link
Member

@popomore popomore commented Oct 12, 2017

Checklist
  • npm test passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)
Description of change
  1. check whether stderr contains log
  2. check starting time, the maximum is 300s
  3. wait app start and exit
  4. drop Windows support

1. check whether stderr contains log
1. check starting time, the maximum is 300s
1. wait app start and exit
@popomore popomore requested a review from atian25 October 12, 2017 08:47
lib/cmd/start.js Outdated
};

this.logger.info(`starting egg application at ${baseDir}`);
this.logger.info(`Starting egg application at ${baseDir}`);
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start 之前是支持 win 的,这样改后就不支持了吧?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

话说,换个思路的话,master 有错误的时候, emit 一个 message 给 parent ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不是功能性的,是体验优化。可以在部署日志里面大致看到错误,而不用上服务器看日志。

master 也没有 app 和 agent 的错误,不知道是谁打的。

Copy link
Member

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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

master 只要有 error 日志,就 kill 掉?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对,不能打到 stderr 里

Copy link
Member

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

Copy link
Member Author

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 日志
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en

@codecov-io
Copy link

codecov-io commented Oct 12, 2017

Codecov Report

Merging #9 into master will increase coverage by 1.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
lib/cmd/start.js 100% <100%> (ø) ⬆️
lib/cmd/stop.js 93.33% <0%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfd0d2f...a3ce0df. Read the comment docs.

@popomore
Copy link
Member Author

@atian25 还有哪些要改的

@popomore
Copy link
Member Author

README 不是写着 windows 不支持吗

@popomore
Copy link
Member Author

starting 的时候最好能取到 framework 的名字

@atian25
Copy link
Member

atian25 commented Oct 12, 2017

starting 的时候最好能取到 framework 的名字

不是有 getFramework 了么? 读下 package.json 然后 print 下?

README 不是写着 windows 不支持吗

只是写着 stop 不支持吧?

如果 start 也不支持的话,README 和 egg docs 都要改下。

+1

@popomore
Copy link
Member Author

@atian25 这个需要发 break 吗

deploy tool for egg project.

**Note: Windows is not supported**

Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

要不然这里兼容下,win 打个 warning 提示不再兼容,跳过这段逻辑

Copy link
Member Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里直接用 getRotatelog(argv.stderr) 返回的流?就不用读文件了?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

哪里读文件了?

@popomore
Copy link
Member Author

那问题可以合并了

@popomore popomore changed the title feat: check the status of app when start on daemon feat: [BREAKING_CHANGE] check the status of app when start on daemon Oct 13, 2017
lib/cmd/start.js Outdated
timeout: {
description: 'a timeout for start when daemon',
type: 'number',
default: 300,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为 ms 符合直觉一点吧? 下面自己除掉.

其他 OK,可以合并

@popomore
Copy link
Member Author

改了

@atian25 atian25 merged commit 0f7ca50 into master Oct 13, 2017
@atian25 atian25 deleted the status branch October 13, 2017 05:20
@atian25
Copy link
Member

atian25 commented Oct 13, 2017

你发 major 吧,然后 egg docs 那边也要改下

@popomore
Copy link
Member Author

  • egg-scripts@2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants