From de03fc6da3e5fdb42dc0ed5ef87d3fedd0c5ebfb Mon Sep 17 00:00:00 2001 From: tom Date: Wed, 12 Jul 2017 00:19:12 +0100 Subject: [PATCH] correctly handling new and old service id types --- component.go | 11 +++++------ service.go | 4 ++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/component.go b/component.go index 18c14f4..5e169d3 100644 --- a/component.go +++ b/component.go @@ -50,12 +50,11 @@ func processComponent(msg *nats.Msg) { } func (c *Component) getID() string { - if strings.Contains(c.Service, "-") { - var pieces []string - pieces = strings.Split(c.Service, "-") - - return pieces[len(pieces)-1] + if len(c.Service) == 36 { + return c.Service } - return c.Service + pieces := strings.Split(c.Service, "-") + + return pieces[len(pieces)-1] } diff --git a/service.go b/service.go index 336139b..e80b70e 100644 --- a/service.go +++ b/service.go @@ -57,6 +57,10 @@ func processService(msg *nats.Msg) { } func (s *Service) getID() string { + if len(s.ID) == 36 { + return s.ID + } + var pieces []string pieces = strings.Split(s.ID, "-")