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

Arpit/add execution pool 2 #719

Merged
merged 67 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
dadcad8
initial
JekaMas Feb 1, 2023
b7ae2b3
linters
JekaMas Feb 1, 2023
2f4dc71
linters
JekaMas Feb 1, 2023
68260d5
remove timeout
JekaMas Feb 1, 2023
5d24c5d
update pool
JekaMas Feb 1, 2023
5e708f0
change pool size function
JekaMas Feb 1, 2023
8ed79e4
check nil
JekaMas Feb 1, 2023
4a81e93
check nil
JekaMas Feb 1, 2023
5d40ea2
fix tests
JekaMas Feb 1, 2023
d446d42
Use execution pool from server in all handlers
cffls Feb 2, 2023
f89cbc6
simplify things
JekaMas Feb 2, 2023
de05d71
test fix
JekaMas Feb 2, 2023
a0cc832
add support for cli, config
temaniarpit27 Feb 2, 2023
09b6a2a
add to cli and config
temaniarpit27 Feb 2, 2023
6f3444c
merge base branch
temaniarpit27 Feb 2, 2023
31dd4d1
debug statements
temaniarpit27 Feb 2, 2023
c6740f9
fix bug
temaniarpit27 Feb 2, 2023
2055034
atomic pointer timeout
temaniarpit27 Feb 2, 2023
6a3ebfb
add apis
temaniarpit27 Feb 2, 2023
2ebf3c6
update workerpool
JekaMas Feb 2, 2023
b723add
fix issues
temaniarpit27 Feb 2, 2023
c592908
change params
temaniarpit27 Feb 2, 2023
0cd5177
fix issues
temaniarpit27 Feb 2, 2023
d81ce8e
fix ipc issue
temaniarpit27 Feb 2, 2023
44af708
remove execution pool from IPC
JekaMas Feb 2, 2023
a8e81b3
revert
JekaMas Feb 2, 2023
4ee790f
fix tests
temaniarpit27 Feb 2, 2023
f092f4c
mutex
JekaMas Feb 2, 2023
d799965
refactor flag and value names
manav2401 Feb 3, 2023
8ac4066
ordering fix
manav2401 Feb 3, 2023
6f8d256
refactor flag and value names
manav2401 Feb 3, 2023
049dbaf
update default ep size to 40
manav2401 Feb 3, 2023
9faf678
fix bor start issues
temaniarpit27 Feb 3, 2023
6f47ad2
revert file changes
temaniarpit27 Feb 3, 2023
9005d74
debug statements
temaniarpit27 Feb 2, 2023
f2574b6
fix bug
temaniarpit27 Feb 2, 2023
6badb3e
update workerpool
JekaMas Feb 2, 2023
521c2f0
atomic pointer timeout
temaniarpit27 Feb 2, 2023
3ccf07d
add apis
temaniarpit27 Feb 2, 2023
8bf055f
Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into…
temaniarpit27 Feb 2, 2023
675fcb7
fix issues
temaniarpit27 Feb 2, 2023
9552a96
change params
temaniarpit27 Feb 2, 2023
9c3056b
fix issues
temaniarpit27 Feb 2, 2023
d0345ee
fix ipc issue
temaniarpit27 Feb 2, 2023
b3c97a3
remove execution pool from IPC
JekaMas Feb 2, 2023
c958fb6
revert
JekaMas Feb 2, 2023
4405b6c
merge base branch
temaniarpit27 Feb 2, 2023
4edc0af
Merge branch 'add-execution-pool' of github.com:maticnetwork/bor into…
temaniarpit27 Feb 2, 2023
6cbca8e
mutex
JekaMas Feb 2, 2023
4a81963
fix tests
temaniarpit27 Feb 2, 2023
3e6a315
Merge branch 'arpit/add-execution-pool' of github.com:maticnetwork/bo…
temaniarpit27 Feb 2, 2023
f5e0bdb
Change default size of execution pool to 40
cffls Feb 3, 2023
f0a0c9a
refactor flag and value names
manav2401 Feb 3, 2023
d6b065c
fix merge conflicts
manav2401 Feb 3, 2023
646e6d8
ordering fix
manav2401 Feb 3, 2023
758b471
refactor flag and value names
manav2401 Feb 3, 2023
146e61b
update default ep size to 40
manav2401 Feb 3, 2023
d19979c
fix bor start issues
temaniarpit27 Feb 3, 2023
e7a1645
revert file changes
temaniarpit27 Feb 3, 2023
c0b21ad
fix linters
temaniarpit27 Feb 3, 2023
43ba1cc
Merge branch 'qa' into arpit/add-execution-pool-2
temaniarpit27 Feb 3, 2023
162d38a
fix go.mod
temaniarpit27 Feb 3, 2023
62ef0bc
Merge branch 'arpit/add-execution-pool-2' of github.com:maticnetwork/…
temaniarpit27 Feb 3, 2023
bc45498
change sec to ms
temaniarpit27 Feb 3, 2023
1e48162
change default value for ep timeout
temaniarpit27 Feb 3, 2023
15738ea
fix node api calls
temaniarpit27 Feb 3, 2023
ee5f284
comment setter for ep timeout
temaniarpit27 Feb 3, 2023
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
4 changes: 4 additions & 0 deletions builder/files/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,17 @@ syncmode = "full"
# api = ["eth", "net", "web3", "txpool", "bor"]
# vhosts = ["*"]
# corsdomain = ["*"]
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.ws]
# enabled = false
# port = 8546
# prefix = ""
# host = "localhost"
# api = ["web3", "net"]
# origins = ["*"]
# ep-size = 40
# ep-requesttimeout = "0s"
# [jsonrpc.graphql]
# enabled = false
# port = 0
Expand Down
2 changes: 1 addition & 1 deletion cmd/clef/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ func signer(c *cli.Context) error {
vhosts := utils.SplitAndTrim(c.GlobalString(utils.HTTPVirtualHostsFlag.Name))
cors := utils.SplitAndTrim(c.GlobalString(utils.HTTPCORSDomainFlag.Name))

srv := rpc.NewServer()
srv := rpc.NewServer(0, 0)
err := node.RegisterApis(rpcAPI, []string{"account"}, srv, false)
if err != nil {
utils.Fatalf("Could not register API: %w", err)
Expand Down
23 changes: 14 additions & 9 deletions docs/cli/example_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,30 @@ ethstats = "" # Reporting URL of a ethstats service (nodename:sec
api = ["eth", "net", "web3", "txpool", "bor"] # API's offered over the HTTP-RPC interface
vhosts = ["localhost"] # Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.
corsdomain = ["localhost"] # Comma separated list of domains from which to accept cross origin requests (browser enforced)
ep-size = 40 # Maximum size of workers to run in rpc execution pool for HTTP requests (default: 40)
ep-requesttimeout = "0s" # Request Timeout for rpc execution pool for HTTP requests (default: 0s, 0s = disabled)
[jsonrpc.ws]
enabled = false # Enable the WS-RPC server
port = 8546 # WS-RPC server listening port
prefix = "" # HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
host = "localhost" # ws.addr
api = ["net", "web3"] # API's offered over the WS-RPC interface
origins = ["localhost"] # Origins from which to accept websockets requests
enabled = false # Enable the WS-RPC server
port = 8546 # WS-RPC server listening port
prefix = "" # HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
host = "localhost" # ws.addr
api = ["net", "web3"] # API's offered over the WS-RPC interface
origins = ["localhost"] # Origins from which to accept websockets requests
ep-size = 40 # Maximum size of workers to run in rpc execution pool for WS requests (default: 40)
ep-requesttimeout = "0s" # Request Timeout for rpc execution pool for WS requests (default: 0s, 0s = disabled)
[jsonrpc.graphql]
enabled = false # Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.
port = 0 #
prefix = "" #
host = "" #
port = 0 #
prefix = "" #
host = "" #
vhosts = ["localhost"] # Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.
corsdomain = ["localhost"] # Comma separated list of domains from which to accept cross origin requests (browser enforced)
[jsonrpc.timeouts]
read = "30s"
write = "30s"
idle = "2m0s"


[gpo]
blocks = 20 # Number of recent blocks to check for gas prices
percentile = 60 # Suggested gas price is the given percentile of a set of recent transaction gas prices
Expand Down
8 changes: 8 additions & 0 deletions docs/cli/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ The ```bor server``` command runs the Bor client.

- ```http.api```: API's offered over the HTTP-RPC interface (default: eth,net,web3,txpool,bor)

- ```http.ep-size```: Maximum size of workers to run in rpc execution pool for HTTP requests (default: 40)

- ```http.ep-requesttimeout```: Request Timeout for rpc execution pool for HTTP requests (default: 0s)

- ```ws```: Enable the WS-RPC server (default: false)

- ```ws.addr```: WS-RPC server listening interface (default: localhost)
Expand All @@ -130,6 +134,10 @@ The ```bor server``` command runs the Bor client.

- ```ws.api```: API's offered over the WS-RPC interface (default: net,web3)

- ```ws.ep-size```: Maximum size of workers to run in rpc execution pool for WS requests (default: 40)

- ```ws.ep-requesttimeout```: Request Timeout for rpc execution pool for WS requests (default: 0s)

- ```graphql```: Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. (default: false)

### P2P Options
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0
github.com/BurntSushi/toml v1.1.0
github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d
github.com/JekaMas/workerpool v1.1.5
github.com/VictoriaMetrics/fastcache v1.6.0
github.com/aws/aws-sdk-go-v2 v1.2.0
github.com/aws/aws-sdk-go-v2/config v1.1.1
Expand Down Expand Up @@ -84,6 +85,8 @@ require (
pgregory.net/rapid v0.4.8
)

require github.com/gammazero/deque v0.2.1 // indirect

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d h1:RO27lgfZF8s9lZ3pWyzc0gCE0RZC+6/PXbRjAa0CNp8=
github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d/go.mod h1:romz7UPgSYhfJkKOalzEEyV6sWtt/eAEm0nX2aOrod0=
github.com/JekaMas/workerpool v1.1.5 h1:xmrx2Zyft95CEGiEqzDxiawptCIRZQ0zZDhTGDFOCaw=
github.com/JekaMas/workerpool v1.1.5/go.mod h1:IoDWPpwMcA27qbuugZKeBslDrgX09lVmksuh9sjzbhc=
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
Expand Down Expand Up @@ -157,6 +159,8 @@ github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gammazero/deque v0.2.1 h1:qSdsbG6pgp6nL7A0+K/B7s12mcCY/5l5SIUpMOl+dC0=
github.com/gammazero/deque v0.2.1/go.mod h1:LFroj8x4cMYCukHJDbxFCkT+r9AndaJnFMuZDV34tuU=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
Expand Down
2 changes: 2 additions & 0 deletions internal/cli/dumpconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func (c *DumpconfigCommand) Run(args []string) int {
userConfig.JsonRPC.HttpTimeout.ReadTimeoutRaw = userConfig.JsonRPC.HttpTimeout.ReadTimeout.String()
userConfig.JsonRPC.HttpTimeout.WriteTimeoutRaw = userConfig.JsonRPC.HttpTimeout.WriteTimeout.String()
userConfig.JsonRPC.HttpTimeout.IdleTimeoutRaw = userConfig.JsonRPC.HttpTimeout.IdleTimeout.String()
userConfig.JsonRPC.Http.ExecutionPoolRequestTimeoutRaw = userConfig.JsonRPC.Http.ExecutionPoolRequestTimeout.String()
userConfig.JsonRPC.Ws.ExecutionPoolRequestTimeoutRaw = userConfig.JsonRPC.Ws.ExecutionPoolRequestTimeout.String()
userConfig.TxPool.RejournalRaw = userConfig.TxPool.Rejournal.String()
userConfig.TxPool.LifeTimeRaw = userConfig.TxPool.LifeTime.String()
userConfig.Sealer.GasPriceRaw = userConfig.Sealer.GasPrice.String()
Expand Down
45 changes: 31 additions & 14 deletions internal/cli/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,13 @@ type APIConfig struct {

// Origins is the list of endpoints to accept requests from (only consumed for websockets)
Origins []string `hcl:"origins,optional" toml:"origins,optional"`

// ExecutionPoolSize is max size of workers to be used for rpc execution
ExecutionPoolSize uint64 `hcl:"ep-size,optional" toml:"ep-size,optional"`

// ExecutionPoolRequestTimeout is timeout used by execution pool for rpc execution
ExecutionPoolRequestTimeout time.Duration `hcl:"-,optional" toml:"-"`
ExecutionPoolRequestTimeoutRaw string `hcl:"ep-requesttimeout,optional" toml:"ep-requesttimeout,optional"`
}

// Used from rpc.HTTPTimeouts
Expand Down Expand Up @@ -507,21 +514,25 @@ func DefaultConfig() *Config {
GasCap: ethconfig.Defaults.RPCGasCap,
TxFeeCap: ethconfig.Defaults.RPCTxFeeCap,
Http: &APIConfig{
Enabled: false,
Port: 8545,
Prefix: "",
Host: "localhost",
API: []string{"eth", "net", "web3", "txpool", "bor"},
Cors: []string{"localhost"},
VHost: []string{"localhost"},
Enabled: false,
Port: 8545,
Prefix: "",
Host: "localhost",
API: []string{"eth", "net", "web3", "txpool", "bor"},
Cors: []string{"localhost"},
VHost: []string{"localhost"},
ExecutionPoolSize: 40,
ExecutionPoolRequestTimeout: 0,
},
Ws: &APIConfig{
Enabled: false,
Port: 8546,
Prefix: "",
Host: "localhost",
API: []string{"net", "web3"},
Origins: []string{"localhost"},
Enabled: false,
Port: 8546,
Prefix: "",
Host: "localhost",
API: []string{"net", "web3"},
Origins: []string{"localhost"},
ExecutionPoolSize: 40,
ExecutionPoolRequestTimeout: 0,
},
Graphql: &APIConfig{
Enabled: false,
Expand Down Expand Up @@ -628,6 +639,8 @@ func (c *Config) fillTimeDurations() error {
{"jsonrpc.timeouts.read", &c.JsonRPC.HttpTimeout.ReadTimeout, &c.JsonRPC.HttpTimeout.ReadTimeoutRaw},
{"jsonrpc.timeouts.write", &c.JsonRPC.HttpTimeout.WriteTimeout, &c.JsonRPC.HttpTimeout.WriteTimeoutRaw},
{"jsonrpc.timeouts.idle", &c.JsonRPC.HttpTimeout.IdleTimeout, &c.JsonRPC.HttpTimeout.IdleTimeoutRaw},
{"jsonrpc.ws.ep-requesttimeout", &c.JsonRPC.Ws.ExecutionPoolRequestTimeout, &c.JsonRPC.Ws.ExecutionPoolRequestTimeoutRaw},
{"jsonrpc.http.ep-requesttimeout", &c.JsonRPC.Http.ExecutionPoolRequestTimeout, &c.JsonRPC.Http.ExecutionPoolRequestTimeoutRaw},
{"txpool.lifetime", &c.TxPool.LifeTime, &c.TxPool.LifeTimeRaw},
{"txpool.rejournal", &c.TxPool.Rejournal, &c.TxPool.RejournalRaw},
{"cache.rejournal", &c.Cache.Rejournal, &c.Cache.RejournalRaw},
Expand Down Expand Up @@ -997,7 +1010,11 @@ func (c *Config) buildNode() (*node.Config, error) {
WriteTimeout: c.JsonRPC.HttpTimeout.WriteTimeout,
IdleTimeout: c.JsonRPC.HttpTimeout.IdleTimeout,
},
RPCBatchLimit: c.RPCBatchLimit,
RPCBatchLimit: c.RPCBatchLimit,
WSJsonRPCExecutionPoolSize: c.JsonRPC.Ws.ExecutionPoolSize,
WSJsonRPCExecutionPoolRequestTimeout: c.JsonRPC.Ws.ExecutionPoolRequestTimeout,
HTTPJsonRPCExecutionPoolSize: c.JsonRPC.Http.ExecutionPoolSize,
HTTPJsonRPCExecutionPoolRequestTimeout: c.JsonRPC.Http.ExecutionPoolRequestTimeout,
}

// dev mode
Expand Down
28 changes: 28 additions & 0 deletions internal/cli/server/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,20 @@ func (c *Command) Flags() *flagset.Flagset {
Default: c.cliConfig.JsonRPC.Http.API,
Group: "JsonRPC",
})
f.Uint64Flag(&flagset.Uint64Flag{
Name: "http.ep-size",
Usage: "Maximum size of workers to run in rpc execution pool for HTTP requests",
Value: &c.cliConfig.JsonRPC.Http.ExecutionPoolSize,
Default: c.cliConfig.JsonRPC.Http.ExecutionPoolSize,
Group: "JsonRPC",
})
f.DurationFlag(&flagset.DurationFlag{
Name: "http.ep-requesttimeout",
Usage: "Request Timeout for rpc execution pool for HTTP requests",
Value: &c.cliConfig.JsonRPC.Http.ExecutionPoolRequestTimeout,
Default: c.cliConfig.JsonRPC.Http.ExecutionPoolRequestTimeout,
Group: "JsonRPC",
})

// ws options
f.BoolFlag(&flagset.BoolFlag{
Expand Down Expand Up @@ -481,6 +495,20 @@ func (c *Command) Flags() *flagset.Flagset {
Default: c.cliConfig.JsonRPC.Ws.API,
Group: "JsonRPC",
})
f.Uint64Flag(&flagset.Uint64Flag{
Name: "ws.ep-size",
Usage: "Maximum size of workers to run in rpc execution pool for WS requests",
Value: &c.cliConfig.JsonRPC.Ws.ExecutionPoolSize,
Default: c.cliConfig.JsonRPC.Ws.ExecutionPoolSize,
Group: "JsonRPC",
})
f.DurationFlag(&flagset.DurationFlag{
Name: "ws.ep-requesttimeout",
Usage: "Request Timeout for rpc execution pool for WS requests",
Value: &c.cliConfig.JsonRPC.Ws.ExecutionPoolRequestTimeout,
Default: c.cliConfig.JsonRPC.Ws.ExecutionPoolRequestTimeout,
Group: "JsonRPC",
})

// graphql options
f.BoolFlag(&flagset.BoolFlag{
Expand Down
28 changes: 28 additions & 0 deletions internal/web3ext/web3ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,34 @@ web3._extend({
name: 'stopWS',
call: 'admin_stopWS'
}),
new web3._extend.Method({
name: 'getExecutionPoolSize',
call: 'admin_getExecutionPoolSize'
}),
new web3._extend.Method({
name: 'getExecutionPoolRequestTimeout',
call: 'admin_getExecutionPoolRequestTimeout'
}),
// new web3._extend.Method({
// name: 'setWSExecutionPoolRequestTimeout',
// call: 'admin_setWSExecutionPoolRequestTimeout',
// params: 1
// }),
// new web3._extend.Method({
// name: 'setHttpExecutionPoolRequestTimeout',
// call: 'admin_setHttpExecutionPoolRequestTimeout',
// params: 1
// }),
new web3._extend.Method({
name: 'setWSExecutionPoolSize',
call: 'admin_setWSExecutionPoolSize',
params: 1
}),
new web3._extend.Method({
name: 'setHttpExecutionPoolSize',
call: 'admin_setHttpExecutionPoolSize',
params: 1
}),
],
properties: [
new web3._extend.Property({
Expand Down
89 changes: 89 additions & 0 deletions node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"strings"
"time"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
Expand Down Expand Up @@ -342,3 +343,91 @@ func (s *publicWeb3API) ClientVersion() string {
func (s *publicWeb3API) Sha3(input hexutil.Bytes) hexutil.Bytes {
return crypto.Keccak256(input)
}

type ExecutionPoolSize struct {
HttpLimit int
WSLimit int
}

type ExecutionPoolRequestTimeout struct {
HttpLimit time.Duration
WSLimit time.Duration
}

func (api *privateAdminAPI) GetExecutionPoolSize() *ExecutionPoolSize {
var httpLimit int
if api.node.http.host != "" {
httpLimit = api.node.http.httpHandler.Load().(*rpcHandler).server.GetExecutionPoolSize()
}

var wsLimit int
if api.node.ws.host != "" {
wsLimit = api.node.ws.wsHandler.Load().(*rpcHandler).server.GetExecutionPoolSize()
}

executionPoolSize := &ExecutionPoolSize{
HttpLimit: httpLimit,
WSLimit: wsLimit,
}

return executionPoolSize
}

func (api *privateAdminAPI) GetExecutionPoolRequestTimeout() *ExecutionPoolRequestTimeout {
var httpLimit time.Duration
if api.node.http.host != "" {
httpLimit = api.node.http.httpHandler.Load().(*rpcHandler).server.GetExecutionPoolRequestTimeout()
}

var wsLimit time.Duration
if api.node.ws.host != "" {
wsLimit = api.node.ws.wsHandler.Load().(*rpcHandler).server.GetExecutionPoolRequestTimeout()
}

executionPoolRequestTimeout := &ExecutionPoolRequestTimeout{
HttpLimit: httpLimit,
WSLimit: wsLimit,
}

return executionPoolRequestTimeout
}

// func (api *privateAdminAPI) SetWSExecutionPoolRequestTimeout(n int) *ExecutionPoolRequestTimeout {
// if api.node.ws.host != "" {
// api.node.ws.wsConfig.executionPoolRequestTimeout = time.Duration(n) * time.Millisecond
// api.node.ws.wsHandler.Load().(*rpcHandler).server.SetExecutionPoolRequestTimeout(time.Duration(n) * time.Millisecond)
// log.Warn("updating ws execution pool request timeout", "timeout", n)
// }

// return api.GetExecutionPoolRequestTimeout()
// }

// func (api *privateAdminAPI) SetHttpExecutionPoolRequestTimeout(n int) *ExecutionPoolRequestTimeout {
// if api.node.http.host != "" {
// api.node.http.httpConfig.executionPoolRequestTimeout = time.Duration(n) * time.Millisecond
// api.node.http.httpHandler.Load().(*rpcHandler).server.SetExecutionPoolRequestTimeout(time.Duration(n) * time.Millisecond)
// log.Warn("updating http execution pool request timeout", "timeout", n)
// }

// return api.GetExecutionPoolRequestTimeout()
// }

func (api *privateAdminAPI) SetWSExecutionPoolSize(n int) *ExecutionPoolSize {
if api.node.ws.host != "" {
api.node.ws.wsConfig.executionPoolSize = uint64(n)
api.node.ws.wsHandler.Load().(*rpcHandler).server.SetExecutionPoolSize(n)
log.Warn("updating ws execution pool size", "threads", n)
}

return api.GetExecutionPoolSize()
}

func (api *privateAdminAPI) SetHttpExecutionPoolSize(n int) *ExecutionPoolSize {
if api.node.http.host != "" {
api.node.http.httpConfig.executionPoolSize = uint64(n)
api.node.http.httpHandler.Load().(*rpcHandler).server.SetExecutionPoolSize(n)
log.Warn("updating http execution pool size", "threads", n)
}

return api.GetExecutionPoolSize()
}
Loading