Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance of the Azure cloud provider #2474

Merged
Prev Previous commit
Next Next commit
Mitigate race
DavidLangworthy committed Nov 6, 2019
commit 7a99522f434b4f826a6620bf02498d6541866b2b
6 changes: 4 additions & 2 deletions cluster-autoscaler/cloudprovider/azure/azure_scale_set.go
Original file line number Diff line number Diff line change
@@ -215,12 +215,14 @@ func (scaleSet *ScaleSet) updateVMSSCapacity(size int64) {
var isSuccess bool
var err error

scaleSet.sizeMutex.Lock()
defer scaleSet.sizeMutex.Unlock()

defer func() {
if err != nil {
klog.Errorf("Failed to update the capacity for vmss %s with error %v, invalidate the cache so as to get the real size from API", scaleSet.Name, err)
// Invalidate the VMSS size cache in order to fetch the size from the API.
scaleSet.sizeMutex.Lock()
defer scaleSet.sizeMutex.Unlock()

scaleSet.lastSizeRefresh = time.Now().Add(-1 * vmssSizeRefreshPeriod)
}
}()