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
fix(generator-helper): continuously handle generator errors #19385
Conversation
Handle generator process errors during the lifetime of the child process and not just during the first 200 ms. This change completely removes `initWaitTime`, which means that `prisma generate` command will now be faster.
CodSpeed Performance ReportMerging #19385 Congrats! CodSpeed is installed 🎉
You will start to see performance impacts in the reports once the benchmarks are run from your default branch.
|
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.
The logic looks sound and better than it was, thank you!
Unless `wait: true` is passed to `open`, it does not install an `error` event listener to the child process, so it's on us to handle it. Before #19385 all errors that happen in CLI were silenly ignored, so this issue was hidden. This PR fixes it. The added e2e test fails with `Error: spawn xdg-open ENOENT` without the changes in `Studio.ts`, and passes with them. Adding special debug logs that the test depends on was necessary since the error happens asynchronously later, so we can't depend on the "Prisma Studio is up on http://localhost:5555" message, and we need to depend on some output that's printed after the point where the ENOENT error may have happened to determine we can send SIGINT to the child process so that test doesn't hang infinitely. An alternative would've been to rely on a timeout to terminate the process, but that would be unreliable/flaky. Fixes: prisma/studio#1128
…19812) Unless `wait: true` is passed to `open`, it does not install an `error` event listener to the child process, so it's on us to handle it. Before #19385 all errors that happen in CLI were silenly ignored, so this issue was hidden. This PR fixes it. The added e2e test fails with `Error: spawn xdg-open ENOENT` without the changes in `Studio.ts`, and passes with them. Adding special debug logs that the test depends on was necessary since the error happens asynchronously later, so we can't depend on the "Prisma Studio is up on http://localhost:5555" message, and we need to depend on some output that's printed after the point where the ENOENT error may have happened to determine we can send SIGINT to the child process so that test doesn't hang infinitely. An alternative would've been to rely on a timeout to terminate the process, but that would be unreliable/flaky. Fixes: prisma/studio#1128
initWaitTime
, handle errors properly all the timewrite EPIPE
error when the generator stopped but the CLI still tries to send messagesFixes #3294
Fixes #8314
Fixes #10291
Fixes #14002