cr feedback

This commit is contained in:
William Banfield
2021-08-18 09:01:23 -04:00
parent cecd5d8ab2
commit 885b78698c
6 changed files with 12 additions and 12 deletions

View File

@@ -55,6 +55,9 @@ func runInspect(cmd *cobra.Command, args []string) error {
blockStore := store.NewBlockStore(blockStoreDB)
stateDB, err := cfg.DefaultDBProvider(&cfg.DBContext{ID: "statestore", Config: config})
if err != nil {
if err := blockStoreDB.Close(); err != nil {
logger.Error("error closing block store db", "error", err)
}
return err
}
genDoc, err := types.GenesisDocFromFile(config.GenesisFile())
@@ -71,7 +74,6 @@ func runInspect(cmd *cobra.Command, args []string) error {
logger.Info("starting inspect server")
if err := ins.Run(ctx); err != nil {
logger.Error("error encountered while running inspect server", "err", err)
return err
}
return nil

View File

@@ -63,7 +63,7 @@ given destination directory. Each archive will contain:
Note: goroutine.out and heap.out will only be written if a profile address is
provided and is operational. This command is blocking and will log any error.
## Tendermint inspect
## Tendermint Inspect
Tendermint includes an `inspect` command for querying Tendermint's state store and block
store over Tendermint RPC.

View File

@@ -64,7 +64,7 @@ It wont kill the node, but it will gather all of the above data and package i
At this point, depending on how severe the degradation is, you may want to restart the process.
## Tendermint inspect
## Tendermint Inspect
What if the Tendermint node will not start up due to inconsistent consensus state?

View File

@@ -99,7 +99,7 @@ func (ins *Inspect) Run(ctx context.Context) error {
return nil
})
g.Go(func() error {
return startRPCServers(ctx, ins.config, ins.logger, ins.routes)
return startRPCServers(tctx, ins.config, ins.logger, ins.routes)
})
<-tctx.Done()
@@ -111,7 +111,7 @@ func (ins *Inspect) Run(ctx context.Context) error {
}
func startRPCServers(ctx context.Context, cfg *config.RPCConfig, logger log.Logger, routes rpccore.RoutesMap) error {
g, _ := errgroup.WithContext(ctx)
g, tctx := errgroup.WithContext(ctx)
listenAddrs := tmstrings.SplitAndTrimEmpty(cfg.ListenAddress, ",", " ")
rh := rpc.Handler(cfg, routes, logger)
for _, listenerAddr := range listenAddrs {
@@ -127,7 +127,7 @@ func startRPCServers(ctx context.Context, cfg *config.RPCConfig, logger log.Logg
g.Go(func() error {
logger.Info("RPC HTTPS server starting", "address", listenerAddr,
"certfile", certFile, "keyfile", keyFile)
err := server.ListenAndServeTLS(ctx, certFile, keyFile)
err := server.ListenAndServeTLS(tctx, certFile, keyFile)
if !errors.Is(err, net.ErrClosed) {
logger.Error("RPC HTTPS server stopped with error", "address", listenerAddr, "err", err)
return err
@@ -138,7 +138,7 @@ func startRPCServers(ctx context.Context, cfg *config.RPCConfig, logger log.Logg
} else {
g.Go(func() error {
logger.Info("RPC HTTP server starting", "address", listenerAddr)
err := server.ListenAndServe(ctx)
err := server.ListenAndServe(tctx)
if !errors.Is(err, net.ErrClosed) {
logger.Error("RPC HTTP server stopped with error", "address", listenerAddr, "err", err)
return err

View File

@@ -168,8 +168,9 @@ func makeNode(config *cfg.Config,
}
go func() {
if !errors.Is(ins.indexerService.Start(), pubsub.ErrUnsubscribed) {
return err
err := indexerService.Start()
if !errors.Is(err, pubsub.ErrUnsubscribed) {
logger.Error("error starting indexer service", "error", err)
}
}()

View File

@@ -20,8 +20,6 @@ type Service struct {
eventSinks []EventSink
eventBus *types.EventBus
doneChan chan struct{}
}
// NewIndexerService returns a new service instance.
@@ -29,7 +27,6 @@ func NewIndexerService(es []EventSink, eventBus *types.EventBus) *Service {
is := &Service{eventSinks: es, eventBus: eventBus}
is.BaseService = *service.NewBaseService(nil, "IndexerService", is)
is.doneChan = make(chan struct{})
return is
}