Skip to content

Commit

Permalink
Ringpop: set tchannel port even if label is missing (cadence-workflow…
Browse files Browse the repository at this point in the history
  • Loading branch information
mantas-sidlauskas authored Mar 8, 2022
1 parent 5ec6c4e commit d3e03c2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions common/peerprovider/ringpopprovider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package ringpopprovider

import (
"fmt"
"net"
"strconv"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -206,6 +207,20 @@ func (r *Provider) GetMembers(service string) ([]membership.HostInfo, error) {
} else {
portMap[membership.PortTchannel] = port
}
} else {
// for backwards compatibility: get tchannel port from member address
_, port, err := net.SplitHostPort(member.Address)
if err != nil {
r.logger.Warn("getting ringpop member port from address", tag.Value(member.Address), tag.Error(err))
} else {
tchannelPort, err := labelToPort(port)
if err != nil {
r.logger.Warn("tchannel port cannot be converted", tag.Error(err), tag.Value(port))
} else {
portMap[membership.PortTchannel] = tchannelPort
}
}

}

if v, ok := member.Label(membership.PortGRPC); ok {
Expand Down

0 comments on commit d3e03c2

Please sign in to comment.