Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasz-antoniak committed Jun 26, 2024
1 parent b8feb06 commit 1d353fa
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions proxy/pkg/zdmproxy/controlconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,11 @@ func (cc *ControlConn) RefreshHosts(conn CqlConnection, ctx context.Context) ([]
}
}

if localHost != nil {
oldLocalhost, localHostExists := hostsById[localHost.HostId]
if localHostExists {
log.Warnf("Local host is also on the peers list: %v vs %v, ignoring the former one.", oldLocalhost, localHost)
}
hostsById[localHost.HostId] = localHost
oldLocalhost, localHostExists := hostsById[localHost.HostId]
if localHostExists {
log.Warnf("Local host is also on the peers list: %v vs %v, ignoring the former one.", oldLocalhost, localHost)
}
hostsById[localHost.HostId] = localHost
orderedLocalHosts := make([]*Host, 0, len(hostsById))
for _, h := range hostsById {
orderedLocalHosts = append(orderedLocalHosts, h)
Expand All @@ -491,11 +489,9 @@ func (cc *ControlConn) RefreshHosts(conn CqlConnection, ctx context.Context) ([]
currentDc := cc.datacenter
cc.topologyLock.RUnlock()

if localHost != nil {
orderedLocalHosts, currentDc, err = filterHosts(orderedLocalHosts, currentDc, cc.connConfig, localHost)
if err != nil {
return nil, err
}
orderedLocalHosts, currentDc, err = filterHosts(orderedLocalHosts, currentDc, cc.connConfig, localHost)
if err != nil {
return nil, err
}

sort.Slice(orderedLocalHosts, func(i, j int) bool {
Expand Down

0 comments on commit 1d353fa

Please sign in to comment.