[#325] node: Introduce unsafe_disable param to disable policer
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful

Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
Airat Arifullin 2023-05-22 13:00:24 +03:00 committed by Evgenii Stratonikov
parent 365a7ca0f4
commit a3e30062df
3 changed files with 13 additions and 1 deletions

View file

@ -25,3 +25,9 @@ func HeadTimeout(c *config.Config) time.Duration {
return HeadTimeoutDefault
}
// UnsafeDisable returns the value of "unsafe_disable" config parameter
// from "policer" section.
func UnsafeDisable(c *config.Config) bool {
return config.BoolSafe(c.Sub(subsection), "unsafe_disable")
}

View file

@ -204,6 +204,11 @@ func initObjectService(c *cfg) {
}
func addPolicer(c *cfg, keyStorage *util.KeyStorage, clientConstructor *cache.ClientCache) {
if policerconfig.UnsafeDisable(c.appCfg) {
c.log.Warn(logs.FrostFSNodePolicerIsDisabled)
return
}
ls := c.cfgObject.cfgLocalStorage.localStorage
pol := policer.New(