@@ -5,14 +5,13 @@ import (
5
5
"errors"
6
6
"fmt"
7
7
"strings"
8
- "time"
9
8
9
+ "github.com/avast/retry-go/v4"
10
10
abci "github.com/cometbft/cometbft/abci/types"
11
11
"github.com/cometbft/cometbft/libs/bytes"
12
12
"github.com/cometbft/cometbft/rpc/client"
13
13
core "github.com/cometbft/cometbft/rpc/core/types"
14
14
"github.com/cosmos/cosmos-sdk/codec"
15
- "github.com/v2fly/v2ray-core/v5/common/retry"
16
15
)
17
16
18
17
// IsNotFoundError checks if the given error string indicates a gRPC NotFound error.
@@ -32,7 +31,7 @@ func (c *Client) ABCIQueryWithOptions(ctx context.Context, path string, data byt
32
31
var result * core.ResultABCIQuery
33
32
34
33
// Define the function to perform the ABCI query.
35
- fn := func () error {
34
+ queryFunc := func () error {
36
35
// Get the RPC client for querying.
37
36
http , err := c .HTTP ()
38
37
if err != nil {
@@ -55,8 +54,12 @@ func (c *Client) ABCIQueryWithOptions(ctx context.Context, path string, data byt
55
54
}
56
55
57
56
// Retry the query using the configured maximum retries and delay.
58
- delay := uint32 (c .queryRetryDelay / time .Millisecond )
59
- if err := retry .Timed (c .queryMaxRetries , delay ).On (fn ); err != nil {
57
+ if err := retry .Do (
58
+ queryFunc ,
59
+ retry .Attempts (c .queryRetries ),
60
+ retry .Delay (c .queryRetryDelay ),
61
+ retry .LastErrorOnly (true ),
62
+ ); err != nil {
60
63
return nil , err
61
64
}
62
65
0 commit comments