Skip to content

Commit e8e262e

Browse files
authored
Add check for 0 reconcile increase percentage (#688)
1 parent 416cc2c commit e8e262e

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

utils/reconciler.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,17 +249,21 @@ func updateReconcileInterval(maxSeconds int, s common.BaseComponentStatus, ba co
249249

250250
// Calculate exponent
251251
exponent := 0
252-
for increasedInterval > minInterval {
253-
increasedInterval = math.Floor(increasedInterval / increase)
254-
exponent += 1
255-
}
256-
newIncrease := math.Pow(1+(intervalIncreasePercentage/100), float64(exponent))
257-
newInterval = int32(minInterval * newIncrease)
252+
if increase > 1 {
253+
for increasedInterval > minInterval {
254+
increasedInterval = math.Floor(increasedInterval / increase)
255+
exponent += 1
256+
}
257+
newIncrease := math.Pow(1+(intervalIncreasePercentage/100), float64(exponent))
258+
newInterval = int32(minInterval * newIncrease)
258259

259-
// If the increased interval exceeds maxSeconds,
260-
// set reconcile interval to maxSeconds
261-
if newInterval >= int32(maxSeconds) {
262-
newInterval = int32(maxSeconds)
260+
// If the increased interval exceeds maxSeconds,
261+
// set reconcile interval to maxSeconds
262+
if newInterval >= int32(maxSeconds) {
263+
newInterval = int32(maxSeconds)
264+
}
265+
} else {
266+
newInterval = int32(minInterval)
263267
}
264268
}
265269

0 commit comments

Comments
 (0)