forked from TrueCloudLab/frostfs-node
[#1031] node: Add maxConnPerHost
to config
It allows configuring number of neo-go client opened connections per one host. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
90dbf3d944
commit
63e035bd8a
5 changed files with 20 additions and 1 deletions
|
@ -19,6 +19,9 @@ const (
|
|||
|
||||
// NotaryDepositDurationDefault is a default deposit duration.
|
||||
NotaryDepositDurationDefault uint32 = 1000
|
||||
|
||||
// MaxConnPerHostDefault is a default maximum of connections per host of the morph client.
|
||||
MaxConnPerHostDefault = 10
|
||||
)
|
||||
|
||||
// RPCEndpoint returns list of values of "rpc_endpoint" config parameter
|
||||
|
@ -65,3 +68,14 @@ func DialTimeout(c *config.Config) time.Duration {
|
|||
func DisableCache(c *config.Config) bool {
|
||||
return config.BoolSafe(c.Sub(subsection), "disable_cache")
|
||||
}
|
||||
|
||||
// MaxConnPerHost return value of "max_connections_per_host" config
|
||||
// parameter from "morph" section.
|
||||
func MaxConnPerHost(c *config.Config) int {
|
||||
v := config.Uint32Safe(c.Sub(subsection), "max_connections_per_host")
|
||||
if v > 0 {
|
||||
return int(v)
|
||||
}
|
||||
|
||||
return MaxConnPerHostDefault
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue