因RPC限速导致sequence-sender异常退出
问题
因RPC限速导致sequence-sender异常退出
2024-11-15T11:49:59.657Z ERROR sync/evmdownloader.go:248 error calling FilterLogs to eth client: 429 Too Many Requests: {"id":9,"jsonrpc":"2.0","error":{"code":-32005,"message":"rate limit exceeded"}}{"pid": 40, "version": "v0.4.0-beta5", "syncer": "l1infotreesync"}
github.com/0xPolygon/cdk/sync.(*EVMDownloaderImplementation).GetLogs
/go/src/github.com/0xPolygon/cdk/sync/evmdownloader.go:248
github.com/0xPolygon/cdk/sync.(*EVMDownloaderImplementation).GetEventsByBlockRange
/go/src/github.com/0xPolygon/cdk/sync/evmdownloader.go:184
github.com/0xPolygon/cdk/sync.(*EVMDownloader).Download
/go/src/github.com/0xPolygon/cdk/sync/evmdownloader.go:97
2024/11/15 11:49:59 getLogs failed too many times (0)
相关代码
type RetryHandler struct {
RetryAfterErrorPeriod time.Duration
MaxRetryAttemptsAfterError int
}
func (h *RetryHandler) Handle(funcName string, attempts int) {
if h.MaxRetryAttemptsAfterError > -1 && attempts >= h.MaxRetryAttemptsAfterError {
log.Fatalf(
"%s failed too many times (%d)",
funcName, h.MaxRetryAttemptsAfterError,
)
}
time.Sleep(h.RetryAfterErrorPeriod)
}
解决
在sequence-sender 配置->L1InfoTreeSync下增加两个配置
- MaxRetryAttemptsAfterError 总共重试多少次后,异常退出,可以设置一个较大值
- RetryAfterErrorPeriod:每次重试的间隔时间
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »