Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Oct 17, 2024
1 parent bb64fb9 commit 8609be5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 4 additions & 2 deletions server/json_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ func StartJSONRPC(
// The calling process canceled or closed the provided context, so we must
// gracefully stop the gRPC server.
logger.Info("stopping JSON-RPC server...", "address", config.JSONRPC.Address)
shutdownCtx, _ := context.WithTimeout(context.Background(), 10*time.Second)
httpSrv.Shutdown(shutdownCtx)
if err := httpSrv.Shutdown(context.Background()); err != nil {
logger.Error("failed to shutdown JSON-RPC server", "error", err.Error())

Check warning on line 152 in server/json_rpc.go

View check run for this annotation

Codecov / codecov/patch

server/json_rpc.go#L150-L152

Added lines #L150 - L152 were not covered by tests
}
return ln.Close()

Check warning on line 154 in server/json_rpc.go

View check run for this annotation

Codecov / codecov/patch

server/json_rpc.go#L154

Added line #L154 was not covered by tests

case err := <-errCh:

Check warning on line 156 in server/json_rpc.go

View check run for this annotation

Codecov / codecov/patch

server/json_rpc.go#L156

Added line #L156 was not covered by tests
if err == http.ErrServerClosed {
Expand Down
6 changes: 5 additions & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,11 @@ func startInProcess(svrCtx *server.Context, clientCtx client.Context, opts Start
idxer = indexer.NewKVIndexer(idxDB, idxLogger, clientCtx)
indexerService := NewEVMIndexerService(idxer, clientCtx.Client.(rpcclient.Client), config.JSONRPC.AllowIndexerGap)
indexerService.SetLogger(servercmtlog.CometLoggerWrapper{Logger: idxLogger})
go indexerService.Start()
go func() {
if err := indexerService.Start(); err != nil {
logger.Error("failed to start evm indexer service", "error", err.Error())

Check warning on line 422 in server/start.go

View check run for this annotation

Codecov / codecov/patch

server/start.go#L420-L422

Added lines #L420 - L422 were not covered by tests
}
}()
}

if config.API.Enable || config.JSONRPC.Enable {
Expand Down
7 changes: 1 addition & 6 deletions testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,12 +647,7 @@ func (n *Network) Cleanup() {
}

if v.jsonrpc != nil {
shutdownCtx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second)
defer cancelFn()

if err := v.jsonrpc.Shutdown(shutdownCtx); err != nil {
v.tmNode.Logger.Error("HTTP server shutdown produced a warning", "error", err.Error())
}
_ = v.jsonrpc.Close()

Check warning on line 650 in testutil/network/network.go

View check run for this annotation

Codecov / codecov/patch

testutil/network/network.go#L650

Added line #L650 was not covered by tests
}
}

Expand Down

0 comments on commit 8609be5

Please sign in to comment.