From 7e821eee4e340d57eebae8e8ab2bbc2292797b4f Mon Sep 17 00:00:00 2001 From: Qwerty5Uiop <105209995+Qwerty5Uiop@users.noreply.github.com> Date: Fri, 17 Jan 2025 13:29:16 +0400 Subject: [PATCH] chore: Decrease catchup interval (#11626) --- apps/indexer/config/dev/besu.exs | 2 +- apps/indexer/config/dev/erigon.exs | 2 +- apps/indexer/config/dev/filecoin.exs | 2 +- apps/indexer/config/dev/ganache.exs | 2 +- apps/indexer/config/dev/geth.exs | 2 +- apps/indexer/config/dev/nethermind.exs | 2 +- apps/indexer/config/dev/rsk.exs | 2 +- apps/indexer/config/prod/besu.exs | 2 +- apps/indexer/config/prod/erigon.exs | 2 +- apps/indexer/config/prod/filecoin.exs | 2 +- apps/indexer/config/prod/ganache.exs | 2 +- apps/indexer/config/prod/geth.exs | 2 +- apps/indexer/config/prod/nethermind.exs | 2 +- apps/indexer/config/prod/rsk.exs | 2 +- .../lib/indexer/block/catchup/bound_interval_supervisor.ex | 3 ++- 15 files changed, 16 insertions(+), 15 deletions(-) diff --git a/apps/indexer/config/dev/besu.exs b/apps/indexer/config/dev/besu.exs index 97efb8820945..7fca512436a0 100644 --- a/apps/indexer/config/dev/besu.exs +++ b/apps/indexer/config/dev/besu.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/dev/erigon.exs b/apps/indexer/config/dev/erigon.exs index 0f526649cdf9..2636876b5201 100644 --- a/apps/indexer/config/dev/erigon.exs +++ b/apps/indexer/config/dev/erigon.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/dev/filecoin.exs b/apps/indexer/config/dev/filecoin.exs index 6701a698480f..4b95daaadb2e 100644 --- a/apps/indexer/config/dev/filecoin.exs +++ b/apps/indexer/config/dev/filecoin.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(1) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/dev/ganache.exs b/apps/indexer/config/dev/ganache.exs index 6360d8141875..0f1fee49f4f9 100644 --- a/apps/indexer/config/dev/ganache.exs +++ b/apps/indexer/config/dev/ganache.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(1) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/dev/geth.exs b/apps/indexer/config/dev/geth.exs index 3e0557898b02..f31c42be4c4b 100644 --- a/apps/indexer/config/dev/geth.exs +++ b/apps/indexer/config/dev/geth.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(1) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/dev/nethermind.exs b/apps/indexer/config/dev/nethermind.exs index a4788dcc7d1f..cac68e53d7f5 100644 --- a/apps/indexer/config/dev/nethermind.exs +++ b/apps/indexer/config/dev/nethermind.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/dev/rsk.exs b/apps/indexer/config/dev/rsk.exs index 012b0f6d0eea..834870c2ba6c 100644 --- a/apps/indexer/config/dev/rsk.exs +++ b/apps/indexer/config/dev/rsk.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), blocks_concurrency: 1, receipts_concurrency: 1, json_rpc_named_arguments: [ diff --git a/apps/indexer/config/prod/besu.exs b/apps/indexer/config/prod/besu.exs index 03c2c8ff4601..60341ae55d1d 100644 --- a/apps/indexer/config/prod/besu.exs +++ b/apps/indexer/config/prod/besu.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/prod/erigon.exs b/apps/indexer/config/prod/erigon.exs index 02367bfc476d..f49677fc218e 100644 --- a/apps/indexer/config/prod/erigon.exs +++ b/apps/indexer/config/prod/erigon.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/prod/filecoin.exs b/apps/indexer/config/prod/filecoin.exs index b5102b1a3fa6..8bbf0307d930 100644 --- a/apps/indexer/config/prod/filecoin.exs +++ b/apps/indexer/config/prod/filecoin.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/prod/ganache.exs b/apps/indexer/config/prod/ganache.exs index 6360d8141875..0f1fee49f4f9 100644 --- a/apps/indexer/config/prod/ganache.exs +++ b/apps/indexer/config/prod/ganache.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(1) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/prod/geth.exs b/apps/indexer/config/prod/geth.exs index 291683ef9eda..7a213fbbfffe 100644 --- a/apps/indexer/config/prod/geth.exs +++ b/apps/indexer/config/prod/geth.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/prod/nethermind.exs b/apps/indexer/config/prod/nethermind.exs index d5b0ce79d9d4..1f42d5ee155d 100644 --- a/apps/indexer/config/prod/nethermind.exs +++ b/apps/indexer/config/prod/nethermind.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout() config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), json_rpc_named_arguments: [ transport: if(System.get_env("ETHEREUM_JSONRPC_TRANSPORT", "http") == "http", diff --git a/apps/indexer/config/prod/rsk.exs b/apps/indexer/config/prod/rsk.exs index 7d7bc9ff4b25..f0c75824564d 100644 --- a/apps/indexer/config/prod/rsk.exs +++ b/apps/indexer/config/prod/rsk.exs @@ -8,7 +8,7 @@ hackney_opts = ConfigHelper.hackney_options() timeout = ConfigHelper.timeout(10) config :indexer, - block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "5s"), + block_interval: ConfigHelper.parse_time_env_var("INDEXER_CATCHUP_BLOCK_INTERVAL", "0s"), blocks_concurrency: 1, receipts_concurrency: 1, json_rpc_named_arguments: [ diff --git a/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex b/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex index 493d774baeae..45a5b7e81b59 100644 --- a/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex +++ b/apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex @@ -68,7 +68,8 @@ defmodule Indexer.Block.Catchup.BoundIntervalSupervisor do block_interval = Map.get(named_arguments, :block_interval, @block_interval) minimum_interval = div(block_interval, 2) - bound_interval = BoundInterval.within(minimum_interval..(minimum_interval * 10)) + maximum_interval = (minimum_interval + :timer.seconds(1)) * 10 + bound_interval = BoundInterval.within(minimum_interval..maximum_interval) %__MODULE__{ fetcher: %Catchup.Fetcher{block_fetcher: block_fetcher, memory_monitor: Map.get(named_arguments, :memory_monitor)},