refactor(js/core): restrict automatic shutdown signal handlers to development environment only#5157
refactor(js/core): restrict automatic shutdown signal handlers to development environment only#5157
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes the explicit process.exit(0) call from the shutdown signal handler in genkit.ts. The review feedback highlights that this change may cause the process to hang indefinitely if active handles remain in the event loop after the cleanup completes. Additionally, the reviewer suggests implementing concurrency protection for the asynchronous shutdown function to prevent race conditions if multiple signals are received.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request restricts the registration of 'SIGTERM' and 'SIGINT' signal handlers to development environments to avoid interfering with the host application's shutdown behavior in production. The review feedback recommends adding error handling to the shutdown function to ensure that the process terminates even if the server cleanup fails.
MichaelDoyle
left a comment
There was a problem hiding this comment.
Awesome, thanks!
I think there are some handlers like this either in the google-cloud plugin or genkit instrumentation code to flush metrics as well, that we might want to take a second look at.
No description provided.