-
Notifications
You must be signed in to change notification settings - Fork 41
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
bug fix: service will never be deregisterd if the status is critical … #101
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,25 +289,20 @@ func (c *CheckRunner) UpdateCheck(checkID types.CheckID, status, output string) | |
return | ||
} | ||
|
||
// Do nothing if update is idempotent | ||
if check.Status == status && check.Output == output { | ||
check.failureCounter = decrementCounter(check.failureCounter) | ||
check.successCounter = decrementCounter(check.successCounter) | ||
return | ||
} | ||
|
||
if status == api.HealthCritical { | ||
check.successCounter = 0 | ||
if check.failureCounter < c.CriticalThreshold { | ||
check.failureCounter++ | ||
return | ||
} | ||
check.failureCounter = 0 | ||
|
||
} else { | ||
check.failureCounter = 0 | ||
if check.successCounter < c.PassingThreshold { | ||
check.successCounter++ | ||
return | ||
} | ||
check.successCounter = 0 | ||
|
||
} | ||
|
||
// Update the critical time tracking | ||
|
@@ -319,6 +314,10 @@ func (c *CheckRunner) UpdateCheck(checkID types.CheckID, status, output string) | |
delete(c.checksCritical, checkID) | ||
} | ||
|
||
// Do nothing if update is idempotent | ||
if check.Status == status && check.Output == output { | ||
return | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to be sure I'm understanding things... moving this return is the 'fix'. So it doesn't skip things between the old return and this one? Wanted to be sure as much of this just seems like a refactor/cleanup but it is fixing something and how this fixes it wasn't called out anywhere (or I missed it). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1, the bug is , if check.Status is cirtical at first(which esm got from consul-agent), and esm checked it again and found it's cirtical, then this process will return. But in fact we need to do something with it. |
||
} | ||
// Defer a sync if the output has changed. This is an optimization around | ||
// frequent updates of output. Instead, we update the output internally, | ||
// and periodically do a write-back to the servers. If there is a status | ||
|
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.
These are the only 2 uses of decrementCounter(). Should probably nuke it as well.