diff --git a/go/vt/vtgateproxy/discovery.go b/go/vt/vtgateproxy/discovery.go index 003f1f9feb7..99bbc255d2d 100644 --- a/go/vt/vtgateproxy/discovery.go +++ b/go/vt/vtgateproxy/discovery.go @@ -161,6 +161,8 @@ func (r *JSONGateConfigResolver) loadConfig() (*[]resolver.Address, []byte, erro // Nothing in the filtered list? Get them all if len(filteredAddrs) == 0 { addrs = allAddrs + } else if *numConnectionsInt == 0 { + addrs = allAddrs } else if len(filteredAddrs) > *numConnectionsInt { addrs = filteredAddrs[0:*numConnectionsInt] } else if len(allAddrs) > *numConnectionsInt {