Skip to content

Commit

Permalink
[api] ServerV2.Stop() use correct context
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinxie committed Mar 28, 2023
1 parent a7ef663 commit 0bf0c35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions api/coreservice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

func TestLogsInRange(t *testing.T) {
require := require.New(t)
svr, _, _, _, cleanCallback := setupTestCoreSerivce()
svr, _, _, _, cleanCallback := setupTestCoreService()
defer cleanCallback()

t.Run("blocks with four logs", func(t *testing.T) {
Expand Down Expand Up @@ -107,7 +107,7 @@ func TestLogsInRange(t *testing.T) {
}

func BenchmarkLogsInRange(b *testing.B) {
svr, _, _, _, cleanCallback := setupTestCoreSerivce()
svr, _, _, _, cleanCallback := setupTestCoreService()
defer cleanCallback()

ctrl := gomock.NewController(b)
Expand Down Expand Up @@ -151,7 +151,7 @@ func getTopicsAddress(addr []string, topics [][]string) (iotexapi.LogsFilter, er
return filter, nil
}

func setupTestCoreSerivce() (CoreService, blockchain.Blockchain, blockdao.BlockDAO, actpool.ActPool, func()) {
func setupTestCoreService() (CoreService, blockchain.Blockchain, blockdao.BlockDAO, actpool.ActPool, func()) {
cfg := newConfig()

// TODO (zhi): revise
Expand Down Expand Up @@ -188,7 +188,7 @@ func TestEstimateGasForAction(t *testing.T) {
require := require.New(t)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
svr, _, _, _, cleanCallback := setupTestCoreSerivce()
svr, _, _, _, cleanCallback := setupTestCoreService()
defer cleanCallback()

estimatedGas, err := svr.EstimateGasForAction(context.Background(), getAction())
Expand Down
2 changes: 1 addition & 1 deletion api/serverV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (svr *ServerV2) Start(ctx context.Context) error {
// Stop stops the GRPC server and the CoreService
func (svr *ServerV2) Stop(ctx context.Context) error {
if svr.tracer != nil {
if err := svr.tracer.Shutdown(context.Background()); err != nil {
if err := svr.tracer.Shutdown(ctx); err != nil {
return errors.Wrap(err, "failed to shutdown api tracer")
}
}
Expand Down

0 comments on commit 0bf0c35

Please sign in to comment.