@@ -44,9 +44,11 @@ func populateQueryReqToPath(ctx context.Context, chain *cosmos.CosmosChain) erro
44
44
45
45
func ABCIQuery (ctx context.Context , chain * cosmos.CosmosChain , req * abci.RequestQuery ) (* abci.ResponseQuery , error ) {
46
46
// Create a connection to the gRPC server.
47
+ path := "cosmos.base.tendermint.v1beta1.Service/ABCIQuery"
47
48
grpcConn , err := grpc .Dial (
48
49
chain .GetHostGRPCAddress (),
49
50
grpc .WithTransportCredentials (insecure .NewCredentials ()),
51
+ retryConfig (),
50
52
)
51
53
if err != nil {
52
54
return & abci.ResponseQuery {}, err
@@ -55,7 +57,7 @@ func ABCIQuery(ctx context.Context, chain *cosmos.CosmosChain, req *abci.Request
55
57
defer grpcConn .Close ()
56
58
57
59
resp := & abci.ResponseQuery {}
58
- err = grpcConn .Invoke (ctx , "cosmos.base.tendermint.v1beta1.Service/ABCIQuery" , req , resp )
60
+ err = grpcConn .Invoke (ctx , path , req , resp )
59
61
if err != nil {
60
62
return & abci.ResponseQuery {}, err
61
63
}
@@ -74,6 +76,7 @@ func GRPCQuery[T any](ctx context.Context, chain *cosmos.CosmosChain, req proto.
74
76
grpcConn , err := grpc .Dial (
75
77
chain .GetHostGRPCAddress (),
76
78
grpc .WithTransportCredentials (insecure .NewCredentials ()),
79
+ retryConfig (),
77
80
)
78
81
if err != nil {
79
82
return nil , err
@@ -95,6 +98,7 @@ func queryFileDescriptors(ctx context.Context, chain *cosmos.CosmosChain) (*refl
95
98
grpcConn , err := grpc .Dial (
96
99
chain .GetHostGRPCAddress (),
97
100
grpc .WithTransportCredentials (insecure .NewCredentials ()),
101
+ retryConfig (),
98
102
)
99
103
if err != nil {
100
104
return nil , err
@@ -113,3 +117,36 @@ func queryFileDescriptors(ctx context.Context, chain *cosmos.CosmosChain) (*refl
113
117
114
118
return resp , nil
115
119
}
120
+
121
+ func retryConfig () grpc.DialOption {
122
+ policy := `{
123
+ "methodConfig": [{
124
+ "name": [{}],
125
+ "retryPolicy": {
126
+ "MaxAttempts": 4,
127
+ "InitialBackoff": ".01s",
128
+ "MaxBackoff": ".01s",
129
+ "BackoffMultiplier": 1.0,
130
+ "RetryableStatusCodes": [
131
+ "CANCELLED",
132
+ "UNKNOWN",
133
+ "DEADLINE_EXCEEDED",
134
+ "NOT_FOUND",
135
+ "ALREADY_EXISTS",
136
+ "PERMISSION_DENIED",
137
+ "RESOURCE_EXHAUSTED",
138
+ "FAILED_PRECONDITION",
139
+ "ABORTED",
140
+ "OUT_OF_RANGE",
141
+ "UNIMPLEMENTED",
142
+ "INTERNAL",
143
+ "UNAVAILABLE",
144
+ "DATA_LOSS",
145
+ "UNAUTHENTICATED"
146
+ ]
147
+ }
148
+ }]
149
+ }`
150
+
151
+ return grpc .WithDefaultServiceConfig (policy )
152
+ }
0 commit comments