Skip to content

Commit

Permalink
Merge pull request #3092 from akhil-rane/remove_wait_group_machineset…
Browse files Browse the repository at this point in the history
…_controller_deletes

🏃 Remove WaitGroup for MachineSet controller deletion requests
  • Loading branch information
k8s-ci-robot authored May 25, 2020
2 parents ea5b234 + fffe3f0 commit a32a783
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions controllers/machineset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"fmt"
"strings"
"sync"
"time"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -382,11 +381,8 @@ func (r *MachineSetReconciler) syncReplicas(ctx context.Context, ms *clusterv1.M
machinesToDelete := getMachinesToDeletePrioritized(machines, diff, deletePriorityFunc)

errCh := make(chan error, diff)
var wg sync.WaitGroup
wg.Add(diff)
for _, machine := range machinesToDelete {
go func(targetMachine *clusterv1.Machine) {
defer wg.Done()
err := r.Client.Delete(context.Background(), targetMachine)
if err != nil {
logger.Error(err, "Unable to delete Machine", "machine", targetMachine.Name)
Expand All @@ -397,7 +393,6 @@ func (r *MachineSetReconciler) syncReplicas(ctx context.Context, ms *clusterv1.M
r.recorder.Eventf(ms, corev1.EventTypeNormal, "SuccessfulDelete", "Deleted machine %q", targetMachine.Name)
}(machine)
}
wg.Wait()
close(errCh)

var errs []error
Expand Down

0 comments on commit a32a783

Please sign in to comment.