@@ -12,9 +12,10 @@ type FuncNotifyStart func(ctx context.Context, streamID streamtypes.StreamID)
1212type GetRestartChanFunc func () <- chan struct {}
1313
1414type Config struct {
15- JitterBufDuration time.Duration
15+ JitterBufMaxDuration time.Duration
16+ JitterBufMinDuration time.Duration
1617 CatchupMaxSpeedFactor float64
17- MaxCatchupAtLag time.Duration
18+ CatchupAtMaxLag time.Duration
1819 StartTimeout time.Duration
1920 ReadTimeout time.Duration
2021 NotifierStart []FuncNotifyStart `yaml:"-"`
@@ -27,14 +28,17 @@ type Config struct {
2728
2829func (cfg Config ) Options () Options {
2930 var opts Options
30- if cfg .JitterBufDuration != 0 {
31- opts = append (opts , OptionJitterBufDuration (cfg .JitterBufDuration ))
31+ if cfg .JitterBufMaxDuration != 0 {
32+ opts = append (opts , OptionJitterBufMaxDuration (cfg .JitterBufMaxDuration ))
33+ }
34+ if cfg .JitterBufMinDuration != 0 {
35+ opts = append (opts , OptionJitterBufMinDuration (cfg .JitterBufMinDuration ))
3236 }
3337 if cfg .CatchupMaxSpeedFactor != 0 {
3438 opts = append (opts , OptionCatchupMaxSpeedFactor (cfg .CatchupMaxSpeedFactor ))
3539 }
36- if cfg .MaxCatchupAtLag != 0 {
37- opts = append (opts , OptionMaxCatchupAtLag (cfg .MaxCatchupAtLag ))
40+ if cfg .CatchupAtMaxLag != 0 {
41+ opts = append (opts , OptionMaxCatchupAtLag (cfg .CatchupAtMaxLag ))
3842 }
3943 if cfg .StartTimeout != 0 {
4044 opts = append (opts , OptionStartTimeout (cfg .StartTimeout ))
@@ -83,18 +87,25 @@ func (s Options) apply(cfg *Config) {
8387
8488var DefaultConfig = func (ctx context.Context ) Config {
8589 return Config {
86- JitterBufDuration : 3 * time .Second ,
87- CatchupMaxSpeedFactor : 10 ,
88- MaxCatchupAtLag : 21 * time .Second ,
90+ JitterBufMinDuration : 200 * time .Millisecond ,
91+ JitterBufMaxDuration : 3 * time .Minute ,
92+ CatchupMaxSpeedFactor : 1.1 ,
93+ CatchupAtMaxLag : 3 * time .Minute ,
8994 StartTimeout : 10 * time .Second ,
9095 ReadTimeout : 10 * time .Second ,
9196 }
9297}
9398
94- type OptionJitterBufDuration time.Duration
99+ type OptionJitterBufMaxDuration time.Duration
100+
101+ func (s OptionJitterBufMaxDuration ) Apply (cfg * Config ) {
102+ cfg .JitterBufMaxDuration = time .Duration (s )
103+ }
104+
105+ type OptionJitterBufMinDuration time.Duration
95106
96- func (s OptionJitterBufDuration ) Apply (cfg * Config ) {
97- cfg .JitterBufDuration = time .Duration (s )
107+ func (s OptionJitterBufMinDuration ) Apply (cfg * Config ) {
108+ cfg .JitterBufMinDuration = time .Duration (s )
98109}
99110
100111type OptionCatchupMaxSpeedFactor float64
@@ -106,7 +117,7 @@ func (s OptionCatchupMaxSpeedFactor) Apply(cfg *Config) {
106117type OptionMaxCatchupAtLag time.Duration
107118
108119func (s OptionMaxCatchupAtLag ) Apply (cfg * Config ) {
109- cfg .MaxCatchupAtLag = time .Duration (s )
120+ cfg .CatchupAtMaxLag = time .Duration (s )
110121}
111122
112123type OptionStartTimeout time.Duration
0 commit comments