Skip to content

Commit ca076ce

Browse files
committed
Size estimator: provide the slide size
1 parent 034d3bd commit ca076ce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dnscrypt-proxy/estimators.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ import (
66
"github.com/lifenjoiner/ewma"
77
)
88

9+
const (
10+
SizeEstimatorEwmaDecay = 100.0
11+
)
12+
913
type QuestionSizeEstimator struct {
1014
sync.RWMutex
1115
minQuestionSize int
1216
ewma *ewma.EWMA
1317
}
1418

1519
func NewQuestionSizeEstimator() QuestionSizeEstimator {
16-
return QuestionSizeEstimator{minQuestionSize: InitialMinQuestionSize, ewma: &ewma.EWMA{}}
20+
return QuestionSizeEstimator{minQuestionSize: InitialMinQuestionSize, ewma: ewma.NewMovingAverage(SizeEstimatorEwmaDecay)}
1721
}
1822

1923
func (questionSizeEstimator *QuestionSizeEstimator) MinQuestionSize() int {

0 commit comments

Comments
 (0)