[#xx] cli: Use grpc.WaitForReady while initializing SDK client
Some checks failed
DCO action / DCO (pull_request) Failing after 38s
Tests and linters / Run gofumpt (pull_request) Successful in 2m13s
Tests and linters / Staticcheck (pull_request) Successful in 2m57s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m27s
Build / Build Components (pull_request) Successful in 3m21s
Vulncheck / Vulncheck (pull_request) Successful in 3m17s
Tests and linters / gopls check (pull_request) Successful in 4m6s
Tests and linters / Tests with -race (pull_request) Successful in 4m40s
Tests and linters / Lint (pull_request) Successful in 6m4s
Tests and linters / Tests (pull_request) Successful in 9m15s

Before, when the target RPC server wasn't available, requests made
by CLI didn't wait for a timeout specified by the '--timeout' option
because of the 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 89d5d387fc
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{
grpc.WithChainUnaryInterceptor(tracing.NewUnaryClientInteceptor()),
grpc.WithChainStreamInterceptor(tracing.NewStreamClientInterceptor()),
grpc.WithDefaultCallOptions(grpc.WaitForReady(true)),
},
}
if timeout := viper.GetDuration(commonflags.Timeout); timeout > 0 {