Prevent deadlock on azure zone fetch in presence of failure

This commit is contained in:
Chris Hoffman 2017-05-01 17:12:12 -05:00
parent 07424af12b
commit 04e2deeb28
No known key found for this signature in database
GPG key ID: 149D8B7A5089954E

View file

@ -40,6 +40,7 @@ type instanceInfo struct {
// GetZone returns the Zone containing the current failure zone and locality region that the program is running in
func (az *Cloud) GetZone() (cloudprovider.Zone, error) {
faultMutex.Lock()
defer faultMutex.Unlock()
if faultDomain == nil {
var err error
faultDomain, err = fetchFaultDomain()
@ -51,7 +52,6 @@ func (az *Cloud) GetZone() (cloudprovider.Zone, error) {
FailureDomain: *faultDomain,
Region: az.Location,
}
faultMutex.Unlock()
return zone, nil
}