Skip to content

Commit

Permalink
chore: Decrease catchup interval (blockscout#11626)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwerty5Uiop authored Jan 17, 2025
1 parent 967aa77 commit 7e821ee
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion apps/indexer/config/dev/besu.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/dev/erigon.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/dev/filecoin.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/dev/ganache.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/dev/geth.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/dev/nethermind.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/dev/rsk.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/prod/besu.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/prod/erigon.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/prod/filecoin.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/prod/ganache.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/prod/geth.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/prod/nethermind.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion apps/indexer/config/prod/rsk.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down

0 comments on commit 7e821ee

Please sign in to comment.