forked from TrueCloudLab/frostfs-node
8c96494da0
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
27 lines
578 B
Go
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
|
|
}
|