-
Notifications
You must be signed in to change notification settings - Fork 23
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: Stop and finalize build on exec termination #332
Conversation
This property is a function and not a getter. Without invoking it as a function, it's value is always truthy.
When the process was terminated, all of the signal handlers were triggered causing multiple logs to be outputted. Skipping stopping the agent once another event has stopped it causes subsequent events to skip straight to exiting, and never finalizes builds. Exiting is tracked so that if it is already being handled, there is no need to handle exiting again.
The previous test tested that PERCY_ENABLED _did not_ work. That is, it tested that a warning was still thrown even though it was disabled. That test has been corrected to assert that _nothing_ is thrown when disabled.
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.
🏁 This is going to solve a lot of issues
@@ -22,7 +22,7 @@ export default class PercyCommand extends Command { | |||
} | |||
|
|||
async run() { | |||
if (this.percyEnabled && !this.percyTokenPresent()) { | |||
if (this.percyEnabled() && !this.percyTokenPresent()) { |
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.
Great catch here 👍
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.
Nice catch!
c883d25
to
7715f6b
Compare
## [0.10.1](v0.10.0...v0.10.1) (2019-08-22) ### Bug Fixes * Stop and finalize build on exec termination ([#332](#332)) ([2fd90b9](2fd90b9))
Purpose
When running
percy exec
with a command that causes the process to hang, terminating the process causes builds to get stuck in a receiving state due to the build never finalizing.Approach
Add signal handlers for
SIGHUP
,SIGINT
, andSIGTERM
to stop and finalize the build.Multiple signals are sometimes sent and cause the stop method to get called multiple times. This didn't seem to effect finalizing builds, but caused noisy output in the terminal. An instance property,
exiting
, is used to bail out of the stop method when it has already been called. This also prevents secondary events from exiting before the first event has finalized the build.Other changes
I also corrected a check for
percyEnabled
which treated the property as a getter when it is actually a method. Fixing this also highlighted a test which actually tested the incorrect behavior. This test was updated to reflect the desired behavior, which is to not warn about a missing token when Percy is disabled.