[#1441] cli: Use grpc.WaitForReady while initializing SDK client
All checks were successful
DCO action / DCO (pull_request) Successful in 1m9s
Tests and linters / Run gofumpt (pull_request) Successful in 1m26s
Tests and linters / Lint (pull_request) Successful in 3m23s
Vulncheck / Vulncheck (pull_request) Successful in 3m24s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m59s
Tests and linters / gopls check (pull_request) Successful in 4m5s
Tests and linters / Staticcheck (pull_request) Successful in 4m25s
Build / Build Components (pull_request) Successful in 4m36s
Tests and linters / Tests (pull_request) Successful in 6m12s
Tests and linters / Tests with -race (pull_request) Successful in 6m52s

Before, when the target RPC server was unavailable, requests made
by CLI didn't wait for a timeout specified by the '--timeout' option
if the timeout was more than 20 seconds. It's because of the gRPC
default backoff strategy. Adding this option fixes that behavior.

Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
This commit is contained in:
Aleksey Savchuk 2024-10-22 10:18:01 +03:00
parent 8b6ec57c61
commit 0a752752ec
Signed by: a-savchuk
GPG key ID: 70C0A7FF6F9C4639

View file

@ -58,6 +58,7 @@ func GetSDKClient(ctx context.Context, cmd *cobra.Command, key *ecdsa.PrivateKey
GRPCDialOptions: []grpc.DialOption{ GRPCDialOptions: []grpc.DialOption{
grpc.WithChainUnaryInterceptor(tracing.NewUnaryClientInteceptor()), grpc.WithChainUnaryInterceptor(tracing.NewUnaryClientInteceptor()),
grpc.WithChainStreamInterceptor(tracing.NewStreamClientInterceptor()), grpc.WithChainStreamInterceptor(tracing.NewStreamClientInterceptor()),
grpc.WithDefaultCallOptions(grpc.WaitForReady(true)),
}, },
} }
if timeout := viper.GetDuration(commonflags.Timeout); timeout > 0 { if timeout := viper.GetDuration(commonflags.Timeout); timeout > 0 {