[#699] neofs/tree: Add healthcheck
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
ad88694adc
commit
f59bf91a67
2 changed files with 5 additions and 2 deletions
|
@ -121,7 +121,7 @@ func (a *App) initLayer(ctx context.Context) {
|
||||||
a.initResolver()
|
a.initResolver()
|
||||||
|
|
||||||
treeServiceEndpoint := a.cfg.GetString(cfgTreeServiceEndpoint)
|
treeServiceEndpoint := a.cfg.GetString(cfgTreeServiceEndpoint)
|
||||||
treeService, err := neofs.NewTreeClient(treeServiceEndpoint, a.key)
|
treeService, err := neofs.NewTreeClient(ctx, treeServiceEndpoint, a.key)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.log.Fatal("failed to create tree service", zap.Error(err))
|
a.log.Fatal("failed to create tree service", zap.Error(err))
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,13 +91,16 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewTreeClient creates instance of TreeClient using provided address and create grpc connection.
|
// NewTreeClient creates instance of TreeClient using provided address and create grpc connection.
|
||||||
func NewTreeClient(addr string, key *keys.PrivateKey) (*TreeClient, error) {
|
func NewTreeClient(ctx context.Context, addr string, key *keys.PrivateKey) (*TreeClient, error) {
|
||||||
conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
conn, err := grpc.Dial(addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("did not connect: %v", err)
|
return nil, fmt.Errorf("did not connect: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c := tree.NewTreeServiceClient(conn)
|
c := tree.NewTreeServiceClient(conn)
|
||||||
|
if _, err = c.Healthcheck(ctx, &tree.HealthcheckRequest{}); err != nil {
|
||||||
|
return nil, fmt.Errorf("healthcheck: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return &TreeClient{
|
return &TreeClient{
|
||||||
key: key,
|
key: key,
|
||||||
|
|
Loading…
Reference in a new issue