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 29, 2023
1 parent a7ef663 commit 025ad80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 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 All @@ -207,7 +207,7 @@ func TestTraceTransaction(t *testing.T) {
require := require.New(t)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
svr, bc, _, ap, cleanCallback := setupTestCoreSerivce()
svr, bc, _, ap, cleanCallback := setupTestCoreService()
defer cleanCallback()
ctx := context.Background()
tsf, err := action.SignedExecution(identityset.Address(29).String(),
Expand Down Expand Up @@ -240,7 +240,7 @@ func TestTraceCall(t *testing.T) {
require := require.New(t)
ctrl := gomock.NewController(t)
defer ctrl.Finish()
svr, bc, _, ap, cleanCallback := setupTestCoreSerivce()
svr, bc, _, ap, cleanCallback := setupTestCoreService()
defer cleanCallback()
ctx := context.Background()
tsf, err := action.SignedExecution(identityset.Address(29).String(),
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 025ad80

Please sign in to comment.