frostfs-node/cmd/neofs-node/config/policer/config.go
Alex Vanin 8c96494da0 [#493] cmd/node: Add policer section to config
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
2021-06-02 16:07:42 +03:00

27 lines
578 B
Go

package policerconfig
import (
"time"
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
)
const (
subsection = "policer"
// HeadTimeoutDefault is a default object.Head request timeout in policer.
HeadTimeoutDefault = 5 * time.Second
)
// HeadTimeout returns value of "head_timeout" config parameter
// from "policer" section.
//
// Returns HeadTimeoutDefault if value is not positive duration.
func HeadTimeout(c *config.Config) time.Duration {
v := config.DurationSafe(c.Sub(subsection), "head_timeout")
if v > 0 {
return v
}
return HeadTimeoutDefault
}