-
Notifications
You must be signed in to change notification settings - Fork 165
fix: do not err on process exit #144
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
Conversation
Signed-off-by: Grant Timmerman <[email protected]>
process.on('exit', code => { | ||
logAndSendError(new Error(`Process exited with code ${code}`), latestRes); | ||
process.on('SIGINT', code => { | ||
console.log(`Process exited with code ${code}`); | ||
}); | ||
|
||
['SIGINT', 'SIGTERM'].forEach(signal => { |
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.
SIGINT
is also handled here. Could you please update this?
@@ -258,8 +258,8 @@ export class ErrorHandler { | |||
logAndSendError(err, latestRes, killInstance); | |||
}); | |||
|
|||
process.on('exit', code => { |
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.
I think this would remove error logging when the process exits from user's function.
I do think we should not log and send error when process exits normally though. How about checking the status code and only logAndSendError
for non-0 ones? Or handing SIGINT
before exit
?
@grant What's the status of this PR? |
I don't know how to test this change, don't want to break GCF, and haven't continued with it. |
This PR is outdated and fixed with #126. |
Fixes: #22 #143
This change the behavior the process exit event handler.
I don't know exactly why we have a
latestRes
modification here or if it's needed. I would assume a process exit does not need to send the latest HTTP response as an exit would not naturally happen.Before
After