From a264cc23de7e3b54079bd4823cf8189009c0aec5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 7 Jun 2021 11:22:19 +0200 Subject: [PATCH] Fix profile deadlock. --- profile/profile.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/profile/profile.go b/profile/profile.go index e4d678ce..3120227b 100644 --- a/profile/profile.go +++ b/profile/profile.go @@ -301,19 +301,15 @@ func (profile *Profile) IsOutdated() bool { return profile.outdated.IsSet() } -// GetEndpoints returns the endpoint list of the profile. +// GetEndpoints returns the endpoint list of the profile. This functions +// requires the profile to be read locked. func (profile *Profile) GetEndpoints() endpoints.Endpoints { - profile.RLock() - defer profile.RUnlock() - return profile.endpoints } -// GetServiceEndpoints returns the service endpoint list of the profile. +// GetServiceEndpoints returns the service endpoint list of the profile. This +// functions requires the profile to be read locked. func (profile *Profile) GetServiceEndpoints() endpoints.Endpoints { - profile.RLock() - defer profile.RUnlock() - return profile.serviceEndpoints }