set ttl to HealthRequest

This commit is contained in:
Evgeniy Kulikov 2020-02-14 12:36:31 +03:00
parent fbfab8cae7
commit 17768b5bfe
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2

View file

@ -11,6 +11,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/nspcc-dev/neofs-api/service"
"github.com/nspcc-dev/neofs-api/state" "github.com/nspcc-dev/neofs-api/state"
"github.com/spf13/viper" "github.com/spf13/viper"
"go.uber.org/zap" "go.uber.org/zap"
@ -246,7 +247,10 @@ func (p *Pool) getConnection(ctx context.Context) (*grpc.ClientConn, error) {
func isAlive(ctx context.Context, log *zap.Logger, cur *grpc.ClientConn) bool { func isAlive(ctx context.Context, log *zap.Logger, cur *grpc.ClientConn) bool {
switch st := cur.GetState(); st { switch st := cur.GetState(); st {
case connectivity.Idle, connectivity.Ready, connectivity.Connecting: case connectivity.Idle, connectivity.Ready, connectivity.Connecting:
res, err := state.NewStatusClient(cur).HealthCheck(ctx, new(state.HealthRequest)) req := new(state.HealthRequest)
req.SetTTL(service.NonForwardingTTL)
res, err := state.NewStatusClient(cur).HealthCheck(ctx, req)
if err != nil { if err != nil {
log.Warn("could not fetch health-check", zap.Error(err)) log.Warn("could not fetch health-check", zap.Error(err))