Skip to content

Commit ae85e16

Browse files
fix(deduplicate): deduplicate targets
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
1 parent a0a05a3 commit ae85e16

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

source/wrappers/dedupsource.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,11 @@ func (ms *dedupSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, err
5454
continue
5555
}
5656

57-
targets := ep.Targets
58-
if len(targets) > 1 {
59-
targets = removeDuplicates(targets)
60-
ep.Targets = targets
57+
if len(ep.Targets) > 1 {
58+
ep.Targets = removeDuplicates(ep.Targets)
6159
}
6260

63-
identifier := strings.Join([]string{ep.RecordType, ep.DNSName, ep.SetIdentifier, targets.String()}, "/")
61+
identifier := strings.Join([]string{ep.RecordType, ep.DNSName, ep.SetIdentifier, ep.Targets.String()}, "/")
6462

6563
if _, ok := collected[identifier]; ok {
6664
log.Debugf("Removing duplicate endpoint %s", ep)
@@ -75,8 +73,7 @@ func (ms *dedupSource) Endpoints(ctx context.Context) ([]*endpoint.Endpoint, err
7573
}
7674

7775
func removeDuplicates(targets []string) []string {
78-
s := set.New(targets...)
79-
return s.SortedList()
76+
return set.New(targets...).SortedList()
8077
}
8178

8279
func (ms *dedupSource) AddEventHandler(ctx context.Context, handler func()) {

0 commit comments

Comments
 (0)