[#1550] engine: Set default error threshold

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-27 09:52:48 +03:00
parent a6d1eefeff
commit dafc21b052

View file

@ -75,10 +75,14 @@ type cfg struct {
shardPoolSize uint32 shardPoolSize uint32
} }
const defaultErrorThreshold = 30
func defaultCfg() *cfg { func defaultCfg() *cfg {
return &cfg{ return &cfg{
log: zap.L(), log: zap.L(),
errorsThreshold: defaultErrorThreshold,
shardPoolSize: 20, shardPoolSize: 20,
} }
} }
@ -123,6 +127,8 @@ func WithShardPoolSize(sz uint32) Option {
// shard is moved to read-only mode. // shard is moved to read-only mode.
func WithErrorThreshold(sz uint32) Option { func WithErrorThreshold(sz uint32) Option {
return func(c *cfg) { return func(c *cfg) {
c.errorsThreshold = sz if sz != 0 {
c.errorsThreshold = sz
}
} }
} }