From 1d201e801bc421d5e100a978e6c042338d3b707d Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Mon, 10 Aug 2020 21:58:35 +0100 Subject: [PATCH] fix etcd keys for services (#1922) --- mdns.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mdns.go b/mdns.go index 33e91be..cb6f48f 100644 --- a/mdns.go +++ b/mdns.go @@ -202,7 +202,8 @@ func createServiceMDNSEntry(name, domain string) (*mdnsEntry, error) { return &mdnsEntry{id: "*", node: srv}, nil } -func (m *mdnsRegistry) getMdnsEntries(domain, serviceName string) ([]*mdnsEntry, error) { +func (m *mdnsRegistry) createMDNSEntries(domain, serviceName string) ([]*mdnsEntry, error) { + // if it already exists don't reegister it again entries, ok := m.domains[domain][serviceName] if ok { return entries, nil @@ -320,7 +321,7 @@ func (m *mdnsRegistry) Register(service *registry.Service, opts ...registry.Regi m.domains[options.Domain] = make(services) } - entries, err := m.getMdnsEntries(options.Domain, service.Name) + entries, err := m.createMDNSEntries(options.Domain, service.Name) if err != nil { m.Unlock() return err