File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -207,9 +207,14 @@ func (c *ConcurrencyAutoScaler) updatePollerPermit() {
207
207
return
208
208
}
209
209
currentQuota := c .concurrency .PollerPermit .Quota ()
210
- // smoothing the scaling through log2
211
- newQuota := int (math .Round (float64 (currentQuota ) * targetPollerWaitTimeInMsLog2 / math .Log2 (
212
- 1 + float64 (c .pollerWaitTime .Average ()/ time .Millisecond ))))
210
+ // smoothing the scaling through log2 with edge case of zero value
211
+ var newQuota int
212
+ if waitTime := c .pollerWaitTime .Average (); waitTime == 0 {
213
+ newQuota = currentQuota * 2
214
+ } else {
215
+ newQuota = int (math .Round (
216
+ float64 (currentQuota ) * targetPollerWaitTimeInMsLog2 / math .Log2 (1 + float64 (waitTime / time .Millisecond ))))
217
+ }
213
218
if newQuota < c .pollerMinCount {
214
219
newQuota = c .pollerMinCount
215
220
}
You can’t perform that action at this time.
0 commit comments