Skip to content
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

希望增加中断进程钩子 #33

Open
sunnyabc789 opened this issue May 3, 2021 · 2 comments · May be fixed by #34
Open

希望增加中断进程钩子 #33

sunnyabc789 opened this issue May 3, 2021 · 2 comments · May be fixed by #34

Comments

@sunnyabc789
Copy link

希望增加SIGINT信号钩子

build-plugin-cone-split-schema
该插件会在编译时生成大量临时文件,
进程完成前中断,则临时文件会保留,
再次启动,这些临时文件会影响第二次编译,
且这些临时文件会污染git changes

sunnyabc789 pushed a commit to sunnyabc789/build-scripts that referenced this issue May 3, 2021
@sunnyabc789 sunnyabc789 linked a pull request May 3, 2021 that will close this issue
@ClarkXia
Copy link
Collaborator

ClarkXia commented May 7, 2021

没太理解这个场景
如果 build-plugin-cone-split-schema 产生的临时文件,应该需要该插件自己处理,SIGINT 事件同样可以在插件内部监听
另外临时文件影响二次编译的,理论上每次都需要重新生成

@sunnyabc789
Copy link
Author

sunnyabc789 commented May 7, 2021

场景

1.process.on('SIGINT',) 是一个异步钩子会加入到事件循环队列
2. start 这个脚本为子进程
3.一般中断时机,会发生在 context.setUp(); 该函数执行的过程中,
此时子进程的主栈尚未清空,执行器执行权不会去到子进程监听的sigint钩子上
4.综上,只能在父进程上进行监听sigint事件

缺点就是 父子进程内存不共享 所以用了临时文件的方式来实现该钩子

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 a pull request may close this issue.

2 participants