@@ -31,8 +31,9 @@ const (
3131 DiscontinuousBlockError = "discontinuous block number"
3232
3333 // Geth connection retry settings
34- GethRetryAttempts = 60 // max retry attempts
35- GethRetryInterval = 5 * time .Second // interval between retries
34+ GethRetryAttempts = 60 // max retry attempts
35+ GethRetryInterval = 5 * time .Second // interval between retries
36+ GethRetryMaxElapsedTime = 30 * time .Minute
3637)
3738
3839// configResponse represents the eth_config RPC response (EIP-7910)
@@ -156,7 +157,9 @@ func (rc *RetryableClient) MPTForkTime() uint64 {
156157// The switchTime should be fetched via FetchGethConfig before calling this function.
157158func NewRetryableClient (authClient * authclient.Client , ethClient * ethclient.Client , nextAuthClient * authclient.Client , nextEthClient * ethclient.Client , switchTime uint64 , logger tmlog.Logger ) * RetryableClient {
158159 logger = logger .With ("module" , "retryClient" )
159-
160+ // set MaxElapsedTime to 30 min
161+ bo := backoff .NewExponentialBackOff ()
162+ bo .MaxElapsedTime = GethRetryMaxElapsedTime
160163 // If next client is not configured, disable switch
161164 if nextAuthClient == nil || nextEthClient == nil {
162165 logger .Info ("L2Next client not configured, switch disabled" )
@@ -166,7 +169,7 @@ func NewRetryableClient(authClient *authclient.Client, ethClient *ethclient.Clie
166169 nextAuthClient : authClient , // fallback to current
167170 nextEthClient : ethClient , // fallback to current
168171 switchTime : switchTime ,
169- b : backoff . NewExponentialBackOff () ,
172+ b : bo ,
170173 logger : logger ,
171174 }
172175 }
@@ -188,7 +191,7 @@ func NewRetryableClient(authClient *authclient.Client, ethClient *ethclient.Clie
188191 nextAuthClient : nextAuthClient ,
189192 nextEthClient : nextEthClient ,
190193 switchTime : switchTime ,
191- b : backoff . NewExponentialBackOff () ,
194+ b : bo ,
192195 logger : logger ,
193196 }
194197
0 commit comments