From 3fe3c5c2cb02f67015f884e04c5935f2e35585cf Mon Sep 17 00:00:00 2001 From: POA <33550681+poa@users.noreply.github.com> Date: Mon, 11 Sep 2023 12:48:25 +0300 Subject: [PATCH] Add INDEXER_ZKEVM_BATCHES_RECHECK_INTERVAL env variable --- apps/indexer/lib/indexer/fetcher/zkevm_txn_batch.ex | 13 ++++++++----- config/runtime.exs | 3 ++- docker-compose/envs/common-blockscout.env | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/indexer/lib/indexer/fetcher/zkevm_txn_batch.ex b/apps/indexer/lib/indexer/fetcher/zkevm_txn_batch.ex index 41f419ff22..b23a49ade4 100644 --- a/apps/indexer/lib/indexer/fetcher/zkevm_txn_batch.ex +++ b/apps/indexer/lib/indexer/fetcher/zkevm_txn_batch.ex @@ -15,7 +15,6 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do alias Explorer.{Chain, Repo} alias Explorer.Chain.{ZkevmLifecycleTxn, ZkevmTxnBatch} - @recheck_latest_batch_interval 60 @zero_hash "0000000000000000000000000000000000000000000000000000000000000000" def child_spec(start_link_arguments) do @@ -38,7 +37,9 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do Logger.metadata(fetcher: :zkevm_txn_batches) # Logger.configure(truncate: :infinity) - chunk_size = Application.get_all_env(:indexer)[Indexer.Fetcher.ZkevmTxnBatch][:chunk_size] + config = Application.get_all_env(:indexer)[Indexer.Fetcher.ZkevmTxnBatch] + chunk_size = config[:chunk_size] + recheck_interval = config[:recheck_interval] Process.send(self(), :continue, []) @@ -48,7 +49,8 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do json_rpc_named_arguments: args[:json_rpc_named_arguments], prev_latest_batch_number: 0, prev_virtual_batch_number: 0, - prev_verified_batch_number: 0 + prev_verified_batch_number: 0, + recheck_interval: recheck_interval }} end @@ -60,7 +62,8 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do json_rpc_named_arguments: json_rpc_named_arguments, prev_latest_batch_number: prev_latest_batch_number, prev_virtual_batch_number: prev_virtual_batch_number, - prev_verified_batch_number: prev_verified_batch_number + prev_verified_batch_number: prev_verified_batch_number, + recheck_interval: recheck_interval } = state ) do {latest_batch_number, virtual_batch_number, verified_batch_number} = @@ -115,7 +118,7 @@ defmodule Indexer.Fetcher.ZkevmTxnBatch do {state, 0} end - Process.send_after(self(), :continue, max(:timer.seconds(@recheck_latest_batch_interval) - handle_duration, 0)) + Process.send_after(self(), :continue, max(:timer.seconds(recheck_interval) - handle_duration, 0)) {:noreply, new_state} end diff --git a/config/runtime.exs b/config/runtime.exs index 7e2411a11b..a8bdf81410 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -614,7 +614,8 @@ config :indexer, Indexer.Fetcher.PolygonEdge.WithdrawalExit, exit_helper: System.get_env("INDEXER_POLYGON_EDGE_L1_EXIT_HELPER_CONTRACT") config :indexer, Indexer.Fetcher.ZkevmTxnBatch, - chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_ZKEVM_BATCHES_CHUNK_SIZE", 20) + chunk_size: ConfigHelper.parse_integer_env_var("INDEXER_ZKEVM_BATCHES_CHUNK_SIZE", 20), + recheck_interval: ConfigHelper.parse_integer_env_var("INDEXER_ZKEVM_BATCHES_RECHECK_INTERVAL", 60) config :indexer, Indexer.Fetcher.ZkevmTxnBatch.Supervisor, enabled: ConfigHelper.parse_bool_env_var("INDEXER_ZKEVM_BATCHES_ENABLED") diff --git a/docker-compose/envs/common-blockscout.env b/docker-compose/envs/common-blockscout.env index 5dc9bcda8c..3a3724eec6 100644 --- a/docker-compose/envs/common-blockscout.env +++ b/docker-compose/envs/common-blockscout.env @@ -143,6 +143,7 @@ INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false # INDEXER_POLYGON_EDGE_ETH_GET_LOGS_RANGE_SIZE= # INDEXER_ZKEVM_BATCHES_ENABLED= # INDEXER_ZKEVM_BATCHES_CHUNK_SIZE= +# INDEXER_ZKEVM_BATCHES_RECHECK_INTERVAL= # INDEXER_REALTIME_FETCHER_MAX_GAP= # INDEXER_FETCHER_INIT_QUERY_LIMIT= # INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT=