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

Remove lock options from the info api #2149

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 2 additions & 7 deletions api/info/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/network"
"github.com/ava-labs/avalanchego/network/peer"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/networking/benchlist"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/utils/constants"
Expand Down Expand Up @@ -59,7 +58,6 @@ type Parameters struct {
VMManager vms.Manager
}

// NewService returns a new admin API service
func NewService(
parameters Parameters,
log logging.Logger,
Expand All @@ -69,7 +67,7 @@ func NewService(
network network.Network,
validators validators.Set,
benchlist benchlist.Manager,
) (*common.HTTPHandler, error) {
) (http.Handler, error) {
newServer := rpc.NewServer()
codec := json.NewCodec()
newServer.RegisterCodec(codec, "application/json")
Expand All @@ -86,10 +84,7 @@ func NewService(
}, "info"); err != nil {
return nil, err
}
return &common.HTTPHandler{
LockOptions: common.NoLock,
Handler: newServer,
}, nil
return newServer, nil
}

// GetNodeVersionReply are the results from calling GetNodeVersion
Expand Down
10 changes: 9 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,15 @@ func (n *Node) initInfoAPI() error {
if err != nil {
return err
}
return n.APIServer.AddRoute(service, &sync.RWMutex{}, "info", "")
return n.APIServer.AddRoute(
&common.HTTPHandler{
LockOptions: common.NoLock,
Handler: service,
},
&sync.RWMutex{},
"info",
"",
)
}

// initHealthAPI initializes the Health API service
Expand Down
Loading