improve: reduce function calling number

Signed-off-by: lowang_bh <lhui_wang@163.com>
This commit is contained in:
lowang_bh
2023-05-11 23:30:05 +08:00
parent e1ad9bee5b
commit 9e598bd938

View File

@@ -348,8 +348,9 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
}
// for any empty indices in the sequence [0,set.Spec.Replicas) create a new Pod at the correct revision
for ord := getStartOrdinal(set); ord <= getEndOrdinal(set); ord++ {
replicaIdx := ord - getStartOrdinal(set)
start, end := getStartOrdinal(set), getEndOrdinal(set)
for ord := start; ord <= end; ord++ {
replicaIdx := ord - start
if replicas[replicaIdx] == nil {
replicas[replicaIdx] = newVersionedStatefulSetPod(
currentSet,