Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fridrik01 committed Dec 11, 2024
1 parent 5ac5c0f commit 06272ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions node-core/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ func (n *node) Start(

// Start all the registered services.
if err := n.registry.StartAll(gctx); err != nil {
// Make sure the services that were successfully started are stopped
// before exiting. We assume that it is safe to call Stop on a
// service that was never started so we can call StopAll here
//#nosec:G703 // ok to ignore this
_ = n.registry.StopAll()
return err
}

Expand Down
3 changes: 2 additions & 1 deletion node-core/services/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import (
type Basic interface {
// Start spawns any goroutines required by the service.
Start(ctx context.Context) error
// Stop stops the service.
// Stop stops the service. It should be safe to call
// Stop on a service that has not been started
Stop() error
// Name returns the name of the service.
Name() string
Expand Down

0 comments on commit 06272ab

Please sign in to comment.