-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
core/services: health Checker cleanup #10670
Conversation
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
// To avoid subscribing chain services twice, we only subscribe them if OCR2 is not enabled. | ||
// If it's enabled, they are going to be registered with relayers by default. | ||
if !cfg.OCR2().Enabled() { | ||
for _, service := range app.relayers.Services() { | ||
checkable := service.(services.Checkable) | ||
if err := app.HealthChecker.Register(service.Name(), checkable); err != nil { | ||
return nil, err | ||
} | ||
} | ||
} |
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 exception is no longer required since the relayer services are now added unconditionally.
healthChecker := services.NewChecker() | ||
for _, s := range srvcs { | ||
if err := healthChecker.Register(s); err != nil { |
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.
Relocated and simplified - no need to cast.
@@ -176,7 +176,8 @@ func (c *checker) update() { | |||
uptimeSeconds.Add(interval.Seconds()) | |||
} | |||
|
|||
func (c *checker) Register(name string, service Checkable) error { | |||
func (c *checker) Register(service Checkable) error { |
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.
Outside of tests, we only check ServiceCtx
s, so every Checkable
implementation already had a Name()
method. Now that method is defined on Checkable
instead of ServiceCtx
.
86104ca
to
9f2e0dd
Compare
0005629
to
ce4b6c7
Compare
I noticed some services were added to the health checker twice, and then found some simplifications while cleaning it up.