diff pkg/models/pubservices.go @ 469:788c87b99bae

465:a8e217119085 removed the mutex and the lazy loading from the internal publishing.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 22 Aug 2018 18:25:51 +0200
parents a8e217119085
children b2dea4e56ff1
line wrap: on
line diff
--- a/pkg/models/pubservices.go	Wed Aug 22 17:56:16 2018 +0200
+++ b/pkg/models/pubservices.go	Wed Aug 22 18:25:51 2018 +0200
@@ -27,6 +27,16 @@
 var PublishedServices = &PubServices{}
 
 func (ps *PubServices) Find(name string) (string, bool) {
+	ps.mu.Lock()
+	defer ps.mu.Unlock()
+
+	if ps.entries == nil {
+		if err := ps.load(); err != nil {
+			log.Printf("error: %v\n", err)
+			return "", false
+		}
+	}
+
 	if ps.has(name) {
 		return config.GeoServerURL() + "/" + name, true
 	}