BUGFIX: fix globalHealth not returning to OK after a FAILED state #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have run into an issue where once a HC has
FAILED
, it will never go back toOK
.This is because on each
healthcheck.Check()
we scan for failed checks, if any check fails, we set the global health to false and return a 503. On subsequent checks, if all results are OK, there is not code to set the global health back to OK.This PR ensures we start from an OK state on each check, if any checks fail, we set the global state to false. On subsequent requests, we set back to OK prior to doing the checks, so if any checks fail it will be set again to FALSE before replying, and if all checks are OK, the OK state is kept.
@adrianlop @jeevatkm please let me know your thoughts on this.
As this is a bugfix, we should tag a new version.