From 04d0a73869da4ac2e2d7edb976c8c0653964e319 Mon Sep 17 00:00:00 2001 From: Yusuke Kato Date: Fri, 4 Oct 2024 16:07:10 +0900 Subject: [PATCH] Refactor internal/net/grpc/client.go (#2674) Signed-off-by: kpango --- internal/net/grpc/client.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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) }