2021-06-02 12:26:51 +00:00
|
|
|
package replicatorconfig
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/cmd/neofs-node/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
subsection = "replicator"
|
|
|
|
|
|
|
|
// PutTimeoutDefault is a default timeout of object put request in replicator.
|
|
|
|
PutTimeoutDefault = 5 * time.Second
|
|
|
|
)
|
|
|
|
|
2022-04-21 11:28:05 +00:00
|
|
|
// PutTimeout returns the value of "put_timeout" config parameter
|
2021-06-02 12:26:51 +00:00
|
|
|
// from "replicator" section.
|
|
|
|
//
|
2022-04-21 11:28:05 +00:00
|
|
|
// Returns PutTimeoutDefault if the value is not positive duration.
|
2021-06-02 12:26:51 +00:00
|
|
|
func PutTimeout(c *config.Config) time.Duration {
|
|
|
|
v := config.DurationSafe(c.Sub(subsection), "put_timeout")
|
|
|
|
if v > 0 {
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
|
|
|
return PutTimeoutDefault
|
|
|
|
}
|