From 049151a71b3eb36ff181e5a522f731379980dfa3 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 12 Dec 2023 10:51:03 -0500 Subject: [PATCH] use the new 'RefreshService(name)' instead of 'RefreshServices()' (#487) --- endpoints/util.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/endpoints/util.go b/endpoints/util.go index 1b009f7e..a1e7238f 100644 --- a/endpoints/util.go +++ b/endpoints/util.go @@ -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 }