Skip to content

Commit

Permalink
plugins: simplify server.MustRegister
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Sep 18, 2023
1 parent d5f69ef commit ce4b6c7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugins/cmd/chainlink-median/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func main() {
p := median.NewPlugin(s.Logger)
defer s.Logger.ErrorIfFn(p.Close, "Failed to close")

s.MustRegister(p.Name(), p)
s.MustRegister(p)

stop := make(chan struct{})
defer close(stop)
Expand Down
2 changes: 1 addition & 1 deletion plugins/cmd/chainlink-solana/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {
p := &pluginRelayer{Base: plugins.Base{Logger: s.Logger}}
defer s.Logger.ErrorIfFn(p.Close, "Failed to close")

s.MustRegister(p.Name(), p)
s.MustRegister(p)

stopCh := make(chan struct{})
defer close(stopCh)
Expand Down
2 changes: 1 addition & 1 deletion plugins/cmd/chainlink-starknet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func main() {
p := &pluginRelayer{Base: plugins.Base{Logger: s.Logger}}
defer s.Logger.ErrorIfFn(p.Close, "Failed to close")

s.MustRegister(p.Name(), p)
s.MustRegister(p)

stopCh := make(chan struct{})
defer close(stopCh)
Expand Down
7 changes: 3 additions & 4 deletions plugins/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ type Server struct {
}

// MustRegister registers the Checkable with services.Checker, or exits upon failure.
func (s *Server) MustRegister(name string, c services.Checkable) {
err := s.Register(c)
if err != nil {
s.Logger.Fatalf("Failed to register %s with health checker: %v", name, err)
func (s *Server) MustRegister(c services.Checkable) {
if err := s.Register(c); err != nil {
s.Logger.Fatalf("Failed to register %s with health checker: %v", c.Name(), err)
}
}

Expand Down

0 comments on commit ce4b6c7

Please sign in to comment.