cleanup: remove more copies of min/max from helper
This commit is contained in:
parent
ea1802ffa0
commit
bff6c88683
|
@ -2823,7 +2823,7 @@ func (c *Client) consulDiscoveryImpl() error {
|
|||
// datacenterQueryLimit, the next heartbeat will pick
|
||||
// a new set of servers so it's okay.
|
||||
shuffleStrings(dcs[1:])
|
||||
dcs = dcs[0:helper.MinInt(len(dcs), datacenterQueryLimit)]
|
||||
dcs = dcs[0:helper.Min(len(dcs), datacenterQueryLimit)]
|
||||
}
|
||||
|
||||
// Query for servers in this client's region only
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
// These functions are coming from consul/lib/math.go
|
||||
package helper
|
||||
|
||||
func MaxInt(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func MinInt(a, b int) int {
|
||||
if a > b {
|
||||
return b
|
||||
}
|
||||
return a
|
||||
}
|
|
@ -544,7 +544,7 @@ func (b *BlockedEvals) unblock(computedClass, quota string, index uint64) {
|
|||
// because any node could potentially be feasible.
|
||||
numEscaped := len(b.escaped)
|
||||
numQuotaLimit := 0
|
||||
unblocked := make(map[*structs.Evaluation]string, helper.MaxInt(numEscaped, 4))
|
||||
unblocked := make(map[*structs.Evaluation]string, helper.Max(numEscaped, 4))
|
||||
|
||||
if numEscaped != 0 && computedClass != "" {
|
||||
for id, wrapped := range b.escaped {
|
||||
|
|
|
@ -961,7 +961,7 @@ func (s *Server) setupBootstrapHandler() error {
|
|||
// walk all datacenter until it finds enough hosts to
|
||||
// form a quorum.
|
||||
shuffleStrings(dcs[1:])
|
||||
dcs = dcs[0:helper.MinInt(len(dcs), datacenterQueryLimit)]
|
||||
dcs = dcs[0:helper.Min(len(dcs), datacenterQueryLimit)]
|
||||
}
|
||||
|
||||
nomadServerServiceName := s.config.ConsulConfig.ServerServiceName
|
||||
|
|
Loading…
Reference in New Issue