diff --git a/internal/net/grpc/client.go b/internal/net/grpc/client.go index 52a919e741..6409d07b1d 100644 --- a/internal/net/grpc/client.go +++ b/internal/net/grpc/client.go @@ -19,7 +19,9 @@ package grpc import ( "context" + "maps" "math" + "slices" "sync/atomic" "time" @@ -155,11 +157,7 @@ func (g *gRPCClient) StartConnectionMonitor(ctx context.Context) (<-chan error, } g.monitorRunning.Store(true) - addrs := make([]string, 0, len(g.addrs)) - for addr := range g.addrs { - addrs = append(addrs, addr) - } - + addrs := slices.Collect(maps.Keys(g.addrs)) if g.dialer != nil { g.dialer.StartDialerCache(ctx) }