Manage BlockReward fetcher params

pull/6952/head
Viktor Baranov 2 years ago
parent 28f5233e70
commit 21fdf670e8
  1. 1
      CHANGELOG.md
  2. 21
      apps/indexer/lib/indexer/fetcher/block_reward.ex
  3. 8
      config/runtime.exs
  4. 2
      docker-compose/envs/common-blockscout.env
  5. 6
      docker/Makefile

@ -24,6 +24,7 @@
### Chore ### Chore
- [#6952](https://github.com/blockscout/blockscout/pull/6952) - Manage BlockReward fetcher params
- [#6929](https://github.com/blockscout/blockscout/pull/6929) - Extend `INDEXER_MEMORY_LIMIT` env parsing - [#6929](https://github.com/blockscout/blockscout/pull/6929) - Extend `INDEXER_MEMORY_LIMIT` env parsing
- [#6902](https://github.com/blockscout/blockscout/pull/6902) - Increase verification timeout to 120 seconds for microservice verification - [#6902](https://github.com/blockscout/blockscout/pull/6902) - Increase verification timeout to 120 seconds for microservice verification

@ -25,13 +25,8 @@ defmodule Indexer.Fetcher.BlockReward do
@behaviour BufferedTask @behaviour BufferedTask
@defaults [ @default_max_batch_size 10
flush_interval: :timer.seconds(3), @default_max_concurrency 4
max_batch_size: 10,
max_concurrency: 4,
task_supervisor: Indexer.Fetcher.BlockReward.TaskSupervisor,
metadata: [fetcher: :block_reward]
]
@doc """ @doc """
Asynchronously fetches block rewards for each `t:Explorer.Chain.Explorer.block_number/0`` in `block_numbers`. Asynchronously fetches block rewards for each `t:Explorer.Chain.Explorer.block_number/0`` in `block_numbers`.
@ -57,7 +52,7 @@ defmodule Indexer.Fetcher.BlockReward do
end end
merged_init_options = merged_init_options =
@defaults defaults()
|> Keyword.merge(mergeable_init_options) |> Keyword.merge(mergeable_init_options)
|> Keyword.put(:state, state) |> Keyword.put(:state, state)
@ -337,4 +332,14 @@ defmodule Indexer.Fetcher.BlockReward do
when is_integer(code) and is_binary(message) and is_binary(block_quantity) do when is_integer(code) and is_binary(message) and is_binary(block_quantity) do
["@", quantity_to_integer(block_quantity), ": (", to_string(code), ") ", message, ?\n] ["@", quantity_to_integer(block_quantity), ": (", to_string(code), ") ", message, ?\n]
end end
defp defaults do
[
flush_interval: :timer.seconds(3),
max_concurrency: Application.get_env(:indexer, __MODULE__)[:concurrency] || @default_max_concurrency,
max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size,
task_supervisor: Indexer.Fetcher.BlockReward.TaskSupervisor,
metadata: [fetcher: :block_reward]
]
end
end end

@ -566,6 +566,14 @@ blocks_catchup_fetcher_missing_ranges_batch_size_default_str = "100000"
config :indexer, Indexer.Block.Catchup.MissingRangesCollector, config :indexer, Indexer.Block.Catchup.MissingRangesCollector,
missing_ranges_batch_size: blocks_catchup_fetcher_missing_ranges_batch_size missing_ranges_batch_size: blocks_catchup_fetcher_missing_ranges_batch_size
{block_reward_fetcher_batch_size, _} = Integer.parse(System.get_env("INDEXER_BLOCK_REWARD_BATCH_SIZE", "10"))
{block_reward_fetcher_concurrency, _} = Integer.parse(System.get_env("INDEXER_BLOCK_REWARD_CONCURRENCY", "4"))
config :indexer, Indexer.Fetcher.BlockReward,
batch_size: block_reward_fetcher_batch_size,
concurrency: block_reward_fetcher_concurrency
{internal_transaction_fetcher_batch_size, _} = {internal_transaction_fetcher_batch_size, _} =
Integer.parse(System.get_env("INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE", "10")) Integer.parse(System.get_env("INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE", "10"))

@ -86,6 +86,8 @@ INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
# INDEXER_CATCHUP_BLOCKS_CONCURRENCY= # INDEXER_CATCHUP_BLOCKS_CONCURRENCY=
# INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE= # INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE=
# INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY= # INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY=
# INDEXER_BLOCK_REWARD_BATCH_SIZE=
# INDEXER_BLOCK_REWARD_CONCURRENCY=
# INDEXER_COIN_BALANCES_BATCH_SIZE= # INDEXER_COIN_BALANCES_BATCH_SIZE=
# INDEXER_COIN_BALANCES_CONCURRENCY= # INDEXER_COIN_BALANCES_CONCURRENCY=
# INDEXER_RECEIPTS_BATCH_SIZE= # INDEXER_RECEIPTS_BATCH_SIZE=

@ -463,6 +463,12 @@ endif
ifdef INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY ifdef INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY=$(INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY=$(INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY)'
endif endif
ifdef INDEXER_BLOCK_REWARD_BATCH_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_BLOCK_REWARD_BATCH_SIZE=$(INDEXER_BLOCK_REWARD_BATCH_SIZE)'
endif
ifdef INDEXER_BLOCK_REWARD_CONCURRENCY
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_BLOCK_REWARD_CONCURRENCY=$(INDEXER_BLOCK_REWARD_CONCURRENCY)'
endif
ifdef INDEXER_COIN_BALANCES_BATCH_SIZE ifdef INDEXER_COIN_BALANCES_BATCH_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_RECEIPTS_BATCH_SIZE=$(INDEXER_RECEIPTS_BATCH_SIZE)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_RECEIPTS_BATCH_SIZE=$(INDEXER_RECEIPTS_BATCH_SIZE)'
endif endif

Loading…
Cancel
Save