Skip to content

Commit 9e598bd

Browse files
committed
improve: reduce function calling number
Signed-off-by: lowang_bh <[email protected]>
1 parent e1ad9be commit 9e598bd

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
@@ -348,8 +348,9 @@ func (ssc *defaultStatefulSetControl) updateStatefulSet(
348348
}
349349

350350
// for any empty indices in the sequence [0,set.Spec.Replicas) create a new Pod at the correct revision
351-
for ord := getStartOrdinal(set); ord <= getEndOrdinal(set); ord++ {
352-
replicaIdx := ord - getStartOrdinal(set)
351+
start, end := getStartOrdinal(set), getEndOrdinal(set)
352+
for ord := start; ord <= end; ord++ {
353+
replicaIdx := ord - start
353354
if replicas[replicaIdx] == nil {
354355
replicas[replicaIdx] = newVersionedStatefulSetPod(
355356
currentSet,

0 commit comments

Comments
 (0)