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

engineProcessのundefinedチェックを追加 #930

Merged
merged 2 commits into from
Sep 10, 2022

Conversation

MT224244
Copy link
Contributor

内容

すぐ上でreturnしているので動作上の影響は無さそうでしたが、型的にはundefinedの可能性があるとしてエラーが出ていたので修正しました。

reject();
}
});
if (engineProcess) {
Copy link
Member

Choose a reason for hiding this comment

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

engineProcessがundefinedのときは、エンジンの起動に失敗した場合っぽいです。
参考↓

voicevox/src/background.ts

Lines 622 to 626 in ab72c91

if (engineProcess === undefined) {
// nop if no process started (already killed or not started yet)
log.info(`ENGINE ${engineId}: Process not started`);
return undefined;

その場合でもrestartEngine(この関数)の通りエンジンを起動しようとするのが良いのかなと思いました!
でもそれを実装していただくのはちょっとPRの内容に合致しないですね・・・↓のTODOコメントsuggestionを採用いただくだけでもOKです!

Suggested change
if (engineProcess) {
// TODO: engineProcessがundefinedのときもエンジンを起動する
if (engineProcess) {

Copy link
Member

Choose a reason for hiding this comment

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

すみません、上のif文を見逃してました。。
ここでengineProcess==undefinedはあり得ない、ということがわかるように、throwにして頂ければ!

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

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

LGTM!!!

@Hiroshiba Hiroshiba merged commit 9c223da into VOICEVOX:main Sep 10, 2022
@MT224244 MT224244 deleted the fix-undefined-check branch September 17, 2022 01:41
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.

2 participants