mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-04 02:14:40 +01:00
Size estimator: provide the slide size
This commit is contained in:
parent
034d3bd424
commit
ca076ce133
1 changed files with 5 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue