From b112a92408fac6a2da5509d5c5c9a86b044ea908 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 1 Apr 2025 13:20:20 +0300 Subject: [PATCH] [#1689] treesvc: Create request after client is initialized Make it easier to follow. Change-Id: I40c4db77f015bb45cb25f16ce24e68188fc14380 Signed-off-by: Evgenii Stratonikov --- pkg/services/tree/cache.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/services/tree/cache.go b/pkg/services/tree/cache.go index e2be2f4a2..a74fdc5dd 100644 --- a/pkg/services/tree/cache.go +++ b/pkg/services/tree/cache.go @@ -117,13 +117,6 @@ func (c *clientCache) dialTreeService(ctx context.Context, netmapAddr string) (* opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) } - req := &HealthcheckRequest{ - Body: &HealthcheckRequest_Body{}, - } - if err := SignMessage(req, c.key); err != nil { - return nil, err - } - cc, err := grpc.NewClient(netAddr.URIAddr(), opts...) if err != nil { return nil, err @@ -131,6 +124,14 @@ func (c *clientCache) dialTreeService(ctx context.Context, netmapAddr string) (* ctx, cancel := context.WithTimeout(ctx, defaultClientConnectTimeout) defer cancel() + + req := &HealthcheckRequest{ + Body: &HealthcheckRequest_Body{}, + } + if err := SignMessage(req, c.key); err != nil { + return nil, err + } + // perform some request to check connection if _, err := NewTreeServiceClient(cc).Healthcheck(ctx, req); err != nil { _ = cc.Close()