local state: use synchronized access to internal maps

This commit is contained in:
Frank Schroeder 2017-10-20 06:24:32 +02:00 committed by Frank Schröder
parent 606e13a569
commit f1028d2486

View file

@ -341,7 +341,7 @@ func (l *State) AddCheck(check *structs.HealthCheck, token string) error {
// if there is a serviceID associated with the check, make sure it exists before adding it
// NOTE - This logic may be moved to be handled within the Agent's Addcheck method after a refactor
if check.ServiceID != "" && l.services[check.ServiceID] == nil {
if check.ServiceID != "" && l.Service(check.ServiceID) == nil {
return fmt.Errorf("Check %q refers to non-existent service %q", check.CheckID, check.ServiceID)
}