We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 755c364 + c3e54b7 commit a173349Copy full SHA for a173349
consul/rtt.go
@@ -386,12 +386,11 @@ func getDatacenterMaps(s serfer, dcs []string) []structs.DatacenterMap {
386
// other things being equal (or if coordinates are disabled).
387
func (s *Server) getDatacentersByDistance() ([]string, error) {
388
s.remoteLock.RLock()
389
- defer s.remoteLock.RUnlock()
390
-
391
- var dcs []string
+ dcs := make([]string, 0, len(s.remoteConsuls))
392
for dc := range s.remoteConsuls {
393
dcs = append(dcs, dc)
394
}
+ s.remoteLock.RUnlock()
395
396
// Sort by name first, since the coordinate sort is stable.
397
sort.Strings(dcs)
0 commit comments