mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 09:33:43 +01:00
use the new 'RefreshService(name)' instead of 'RefreshServices()' (#487)
This commit is contained in:
parent
b376683b28
commit
049151a71b
@ -8,14 +8,19 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetRefreshedService(name string, ctx ziti.Context) (*rest_model.ServiceDetail, bool) {
|
func GetRefreshedService(svcName string, ctx ziti.Context) (*rest_model.ServiceDetail, bool) {
|
||||||
svc, found := ctx.GetService(name)
|
svc, found := ctx.GetService(svcName)
|
||||||
if !found {
|
if !found {
|
||||||
if err := ctx.RefreshServices(); err != nil {
|
svc, err := ctx.RefreshService(svcName)
|
||||||
logrus.Errorf("error refreshing services: %v", err)
|
if err != nil {
|
||||||
|
logrus.Errorf("error refreshing service '%v': %v", svcName, err)
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
return ctx.GetService(name)
|
if svc == nil {
|
||||||
|
logrus.Errorf("service '%v' not found", svcName)
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
return svc, true
|
||||||
}
|
}
|
||||||
return svc, found
|
return svc, found
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user