*: add experimental flag for watch notify interval

This commit is contained in:
jingyih
2020-08-13 20:52:19 -07:00
parent 06f89cc4f8
commit 9a698476bf
6 changed files with 66 additions and 47 deletions

View File

@@ -31,6 +31,8 @@ import (
"go.uber.org/zap"
)
const minWatchProgressInterval = 100 * time.Millisecond
type watchServer struct {
lg *zap.Logger
@@ -61,6 +63,16 @@ func NewWatchServer(s *etcdserver.EtcdServer) pb.WatchServer {
if srv.lg == nil {
srv.lg = zap.NewNop()
}
if s.Cfg.WatchProgressNotifyInterval > 0 {
if s.Cfg.WatchProgressNotifyInterval < minWatchProgressInterval {
srv.lg.Warn(
"adjusting watch progress notify interval to minimum period",
zap.Duration("min-watch-progress-notify-interval", minWatchProgressInterval),
)
s.Cfg.WatchProgressNotifyInterval = minWatchProgressInterval
}
SetProgressReportInterval(s.Cfg.WatchProgressNotifyInterval)
}
return srv
}