mirror of
https://github.com/openziti/zrok.git
synced 2024-11-25 01:23:49 +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"
|
||||
)
|
||||
|
||||
func GetRefreshedService(name string, ctx ziti.Context) (*rest_model.ServiceDetail, bool) {
|
||||
svc, found := ctx.GetService(name)
|
||||
func GetRefreshedService(svcName string, ctx ziti.Context) (*rest_model.ServiceDetail, bool) {
|
||||
svc, found := ctx.GetService(svcName)
|
||||
if !found {
|
||||
if err := ctx.RefreshServices(); err != nil {
|
||||
logrus.Errorf("error refreshing services: %v", err)
|
||||
svc, err := ctx.RefreshService(svcName)
|
||||
if err != nil {
|
||||
logrus.Errorf("error refreshing service '%v': %v", svcName, err)
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user