frostfs-node/cmd/neofs-node/config/policer/config.go
Elizaveta Chichindaeva cc7a723d77 [#1320] English Check
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
2022-05-11 10:40:02 +03:00

27 lines
586 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 the value of "head_timeout" config parameter
// from "policer" section.
//
// Returns HeadTimeoutDefault if the 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
}