Mercurial > gemma
changeset 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 | ff9dbe14f033 |
children | 638371a0e557 |
files | pkg/models/pubservices.go |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
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 }