File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
cluster-autoscaler/cloudprovider/azure Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -411,9 +411,6 @@ func (scaleSet *ScaleSet) DeleteInstances(instances []*azureRef) error {
411411 return err
412412 }
413413
414- scaleSet .instanceMutex .Lock ()
415- defer scaleSet .instanceMutex .Unlock ()
416-
417414 instanceIDs := []string {}
418415 for _ , instance := range instances {
419416 asg , err := scaleSet .manager .GetAsgForInstance (instance )
@@ -425,10 +422,12 @@ func (scaleSet *ScaleSet) DeleteInstances(instances []*azureRef) error {
425422 return fmt .Errorf ("cannot delete instance (%s) which don't belong to the same Scale Set (%q)" , instance .Name , commonAsg )
426423 }
427424
425+ scaleSet .instanceMutex .Lock ()
428426 if cpi , found := scaleSet .getInstanceByProviderID (instance .Name ); found && cpi .Status != nil && cpi .Status .State == cloudprovider .InstanceDeleting {
429427 klog .V (3 ).Infof ("Skipping deleting instance %s as its current state is deleting" , instance .Name )
430428 continue
431429 }
430+ scaleSet .instanceMutex .Unlock ()
432431
433432 instanceID , err := getLastSegment (instance .Name )
434433 if err != nil {
You can’t perform that action at this time.
0 commit comments