Skip to content

Commit

Permalink
remove redundant update for performance (#4248)
Browse files Browse the repository at this point in the history
remove redundant update to avoid upper replicas update must has conflict error, although it's in retry.RetryOnConflict()

Signed-off-by: LiuXiang <[email protected]>
  • Loading branch information
lx1036 authored Aug 27, 2024
1 parent b2e4e61 commit 6cc47b8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
8 changes: 0 additions & 8 deletions pkg/ctrl/affinity.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ limitations under the License.
package ctrl

import (
"context"

datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
"github.com/fluid-cloudnative/fluid/pkg/common"
"github.com/fluid-cloudnative/fluid/pkg/utils"
Expand Down Expand Up @@ -166,12 +164,6 @@ func (e *Helper) BuildWorkersAffinity(workers *appsv1.StatefulSet) (workersToUpd
dataset.Spec.NodeAffinity.Required
}
}

err = e.client.Update(context.TODO(), workersToUpdate)
if err != nil {
return workersToUpdate, err
}

}

return
Expand Down
3 changes: 1 addition & 2 deletions pkg/ctrl/affinity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ func TestBuildWorkersAffinityForEFCRuntime(t *testing.T) {
},
want: &v1.Affinity{
PodAntiAffinity: &v1.PodAntiAffinity{
// The fake client makes empty slice to nil
//PreferredDuringSchedulingIgnoredDuringExecution: []v1.WeightedPodAffinityTerm{},
PreferredDuringSchedulingIgnoredDuringExecution: []v1.WeightedPodAffinityTerm{},
RequiredDuringSchedulingIgnoredDuringExecution: []v1.PodAffinityTerm{
{
LabelSelector: &metav1.LabelSelector{
Expand Down

0 comments on commit 6cc47b8

Please sign in to comment.