Skip to content

Commit

Permalink
support unlimited connect retries with negative value
Browse files Browse the repository at this point in the history
Signed-off-by: Yilun <[email protected]>
  • Loading branch information
yilunzhang committed Jan 24, 2023
1 parent 9c3f5a3 commit e903dc0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ func (c *Client) connectToNode(node *Node) error {

func (c *Client) connect(maxRetries int) error {
retryInterval := c.config.MinReconnectInterval
for retry := 1; maxRetries == 0 || retry <= maxRetries; retry++ {
for retry := 1; maxRetries < 0 || retry <= maxRetries; retry++ {
if retry > 1 {
log.Printf("Retry in %v ms...", retryInterval)
time.Sleep(time.Duration(retryInterval) * time.Millisecond)
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type ClientConfig struct {
RPCTimeout int32 // Timeout for each RPC call in millisecond
RPCConcurrency int32 // If greater than 1, the same rpc request will be concurrently sent to multiple seed rpc nodes
MsgChanLen int32 // Channel length for received but unproccessed messages.
ConnectRetries int32 // Connnect to node retries (including the initial connect). 0 means unlimited retries.
ConnectRetries int32 // Connnect to node retries (including the initial connect). A negative value means unlimited retries.
MsgCacheExpiration int32 // Message cache expiration in millisecond for response channel, multiclient message id deduplicate, etc.
MsgCacheCleanupInterval int32 // Message cache cleanup interval in millisecond.
WsHandshakeTimeout int32 // WebSocket handshake timeout in millisecond.
Expand Down

0 comments on commit e903dc0

Please sign in to comment.