Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[api] ServerV2.Stop() use correct context #3837

Merged
merged 4 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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