Skip to content

Commit aa8f287

Browse files
authored
Merge pull request kubernetes#117943 from lowang-bh/lessFunCall
improve: reduce function calling number
2 parents 1af81c2 + 9e598bd commit aa8f287

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/controller/statefulset/stateful_set_control.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,9 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
566566
}
567567

568568
// for any empty indices in the sequence [0,set.Spec.Replicas) create a new Pod at the correct revision
569-
for ord := getStartOrdinal(set); ord <= getEndOrdinal(set); ord++ {
570-
replicaIdx := ord - getStartOrdinal(set)
569+
start, end := getStartOrdinal(set), getEndOrdinal(set)
570+
for ord := start; ord <= end; ord++ {
571+
replicaIdx := ord - start
571572
if replicas[replicaIdx] == nil {
572573
replicas[replicaIdx] = newVersionedStatefulSetPod(
573574
currentSet,

0 commit comments

Comments
 (0)