Size estimator: provide the slide size

This commit is contained in:
Frank Denis 2022-02-21 14:16:13 +01:00
parent 034d3bd424
commit ca076ce133
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,10 @@ import (
"github.com/lifenjoiner/ewma"
)
const (
SizeEstimatorEwmaDecay = 100.0
)
type QuestionSizeEstimator struct {
sync.RWMutex
minQuestionSize int
@ -13,7 +17,7 @@ type QuestionSizeEstimator struct {
}
func NewQuestionSizeEstimator() QuestionSizeEstimator {
return QuestionSizeEstimator{minQuestionSize: InitialMinQuestionSize, ewma: &ewma.EWMA{}}
return QuestionSizeEstimator{minQuestionSize: InitialMinQuestionSize, ewma: ewma.NewMovingAverage(SizeEstimatorEwmaDecay)}
}
func (questionSizeEstimator *QuestionSizeEstimator) MinQuestionSize() int {