@@ -34,7 +34,7 @@ import (
34
34
)
35
35
36
36
const (
37
- defaultAutoScalerUpdateTick = time .Second
37
+ defaultAutoScalerUpdateTick = time .Second
38
38
targetPollerWaitTimeInMsLog2 = 4 // 16 ms
39
39
numberOfPollsInRollingAverage = 20
40
40
@@ -50,9 +50,9 @@ const (
50
50
autoScalerEventLogMsg string = "concurrency auto scaler event"
51
51
testTimeFormat string = "15:04:05"
52
52
53
- metricsEnabled = "enabled"
54
- metricsDisabled = "disabled"
55
- metricsPollerQuota = "poller-quota"
53
+ metricsEnabled = "enabled"
54
+ metricsDisabled = "disabled"
55
+ metricsPollerQuota = "poller-quota"
56
56
metricsPollerWaitTime = "poller-wait-time"
57
57
)
58
58
@@ -69,14 +69,14 @@ type (
69
69
updateTick time.Duration
70
70
71
71
// state of autoscaler
72
- lock sync.RWMutex
72
+ lock sync.RWMutex
73
73
enabled bool
74
74
75
75
// poller
76
76
pollerInitCount int
77
77
pollerMaxCount int
78
78
pollerMinCount int
79
- pollerWaitTime * rollingAverage [time.Duration ]
79
+ pollerWaitTime * rollingAverage [time.Duration ]
80
80
pollerPermitLastUpdate time.Time
81
81
}
82
82
@@ -111,7 +111,7 @@ func NewConcurrencyAutoScaler(input ConcurrencyAutoScalerInput) *ConcurrencyAuto
111
111
pollerInitCount : input .Concurrency .PollerPermit .Quota (),
112
112
pollerMaxCount : input .PollerMaxCount ,
113
113
pollerMinCount : input .PollerMinCount ,
114
- pollerWaitTime : newRollingAverage [time.Duration ](numberOfPollsInRollingAverage ),
114
+ pollerWaitTime : newRollingAverage [time.Duration ](numberOfPollsInRollingAverage ),
115
115
pollerPermitLastUpdate : input .Clock .Now (),
116
116
}
117
117
}
@@ -157,7 +157,7 @@ func (c *ConcurrencyAutoScaler) ProcessPollerHint(hint *shared.AutoConfigHint) {
157
157
}
158
158
if hint .PollerWaitTimeInMs != nil {
159
159
waitTimeInMs := * hint .PollerWaitTimeInMs
160
- c .pollerWaitTime .Add (time .Millisecond * time .Duration (waitTimeInMs ))
160
+ c .pollerWaitTime .Add (time .Millisecond * time .Duration (waitTimeInMs ))
161
161
}
162
162
163
163
var shouldEnable bool
@@ -209,7 +209,7 @@ func (c *ConcurrencyAutoScaler) updatePollerPermit() {
209
209
currentQuota := c .concurrency .PollerPermit .Quota ()
210
210
// smoothing the scaling through log2
211
211
newQuota := int (math .Round (float64 (currentQuota ) * targetPollerWaitTimeInMsLog2 / math .Log2 (
212
- 1 + float64 (c .pollerWaitTime .Average ()/ time .Millisecond )) ))
212
+ 1 + float64 (c .pollerWaitTime .Average ()/ time .Millisecond ))))
213
213
if newQuota < c .pollerMinCount {
214
214
newQuota = c .pollerMinCount
215
215
}
0 commit comments