[#1689] treesvc: Create request after client is initialized
Make it easier to follow. Change-Id: I40c4db77f015bb45cb25f16ce24e68188fc14380 Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
19ca907223
commit
b112a92408
1 changed files with 8 additions and 7 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Reference in a new issue