Define batch size for token balance fetcher via runtime env var

pull/7439/head
Viktor Baranov 2 years ago
parent de6c413d46
commit cc4bbe2d4c
  1. 2
      CHANGELOG.md
  2. 18
      apps/indexer/lib/indexer/fetcher/token_balance.ex
  3. 3
      config/runtime.exs
  4. 1
      docker-compose/envs/common-blockscout.env
  5. 4
      docker/Makefile

@ -4,6 +4,7 @@
### Features ### Features
- [#7439](https://github.com/blockscout/blockscout/pull/7439) - Define batch size for token balance fetcher via runtime env var
- [#7298](https://github.com/blockscout/blockscout/pull/7298) - Add changes to support force email verification - [#7298](https://github.com/blockscout/blockscout/pull/7298) - Add changes to support force email verification
- [#7416](https://github.com/blockscout/blockscout/pull/7416) - Add option to disable reCAPTCHA - [#7416](https://github.com/blockscout/blockscout/pull/7416) - Add option to disable reCAPTCHA
- [#6694](https://github.com/blockscout/blockscout/pull/6694) - Add withdrawals support (EIP-4895) - [#6694](https://github.com/blockscout/blockscout/pull/6694) - Add withdrawals support (EIP-4895)
@ -12,6 +13,7 @@
- [#7436](https://github.com/blockscout/blockscout/pull/7436) - TokenBalanceOnDemand ERC-1155 support - [#7436](https://github.com/blockscout/blockscout/pull/7436) - TokenBalanceOnDemand ERC-1155 support
### Fixes ### Fixes
- [#7391](https://github.com/blockscout/blockscout/pull/7391) - Fix: cannot read properties of null (reading 'value') - [#7391](https://github.com/blockscout/blockscout/pull/7391) - Fix: cannot read properties of null (reading 'value')
- [#7377](https://github.com/blockscout/blockscout/pull/7377) - API v2 improvements - [#7377](https://github.com/blockscout/blockscout/pull/7377) - API v2 improvements

@ -24,12 +24,7 @@ defmodule Indexer.Fetcher.TokenBalance do
@behaviour BufferedTask @behaviour BufferedTask
@defaults [ @default_max_batch_size 100
flush_interval: 300,
max_batch_size: 100,
max_concurrency: 10,
task_supervisor: Indexer.Fetcher.TokenBalance.TaskSupervisor
]
@max_retries 3 @max_retries 3
@ -50,7 +45,7 @@ defmodule Indexer.Fetcher.TokenBalance do
end end
merged_init_opts = merged_init_opts =
@defaults defaults()
|> Keyword.merge(mergeable_init_options) |> Keyword.merge(mergeable_init_options)
|> Keyword.put(:state, state) |> Keyword.put(:state, state)
@ -217,4 +212,13 @@ defmodule Indexer.Fetcher.TokenBalance do
token_id: token_id token_id: token_id
} }
end end
defp defaults do
[
flush_interval: 300,
max_batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @default_max_batch_size,
max_concurrency: 10,
task_supervisor: Indexer.Fetcher.TokenBalance.TaskSupervisor
]
end
end end

@ -427,6 +427,9 @@ config :indexer, Indexer.Fetcher.PendingTransaction.Supervisor,
System.get_env("ETHEREUM_JSONRPC_VARIANT") == "besu" || System.get_env("ETHEREUM_JSONRPC_VARIANT") == "besu" ||
ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER") ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER")
config :indexer, Indexer.Fetcher.TokenBalance,
batch_size: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_BATCH_SIZE", 100)
config :indexer, Indexer.Fetcher.TokenBalanceOnDemand, config :indexer, Indexer.Fetcher.TokenBalanceOnDemand,
threshold: ConfigHelper.parse_time_env_var("TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD", "1h"), threshold: ConfigHelper.parse_time_env_var("TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD", "1h"),
fallback_threshold_in_blocks: 500 fallback_threshold_in_blocks: 500

@ -110,6 +110,7 @@ INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
# INDEXER_COIN_BALANCES_CONCURRENCY= # INDEXER_COIN_BALANCES_CONCURRENCY=
# INDEXER_RECEIPTS_BATCH_SIZE= # INDEXER_RECEIPTS_BATCH_SIZE=
# INDEXER_RECEIPTS_CONCURRENCY= # INDEXER_RECEIPTS_CONCURRENCY=
# INDEXER_TOKEN_BALANCES_BATCH_SIZE=
# INDEXER_TX_ACTIONS_ENABLE= # INDEXER_TX_ACTIONS_ENABLE=
# INDEXER_TX_ACTIONS_MAX_TOKEN_CACHE_SIZE= # INDEXER_TX_ACTIONS_MAX_TOKEN_CACHE_SIZE=
# INDEXER_TX_ACTIONS_REINDEX_FIRST_BLOCK= # INDEXER_TX_ACTIONS_REINDEX_FIRST_BLOCK=

@ -552,11 +552,15 @@ endif
ifdef INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE ifdef INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE=$(INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE=$(INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE)'
endif endif
ifdef INDEXER_TOKEN_BALANCES_BATCH_SIZE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_TOKEN_BALANCES_BATCH_SIZE=$(INDEXER_TOKEN_BALANCES_BATCH_SIZE)'
endif
ifdef INDEXER_REALTIME_FETCHER_MAX_GAP ifdef INDEXER_REALTIME_FETCHER_MAX_GAP
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_REALTIME_FETCHER_MAX_GAP=$(INDEXER_REALTIME_FETCHER_MAX_GAP)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_REALTIME_FETCHER_MAX_GAP=$(INDEXER_REALTIME_FETCHER_MAX_GAP)'
endif endif
ifdef INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE ifdef INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE=$(INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE=$(INDEXER_INTERNAL_TRANSACTIONS_TRACER_TYPE)'
endif
ifdef INDEXER_DISABLE_WITHDRAWALS_FETCHER ifdef INDEXER_DISABLE_WITHDRAWALS_FETCHER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_WITHDRAWALS_FETCHER=$(INDEXER_DISABLE_WITHDRAWALS_FETCHER)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_WITHDRAWALS_FETCHER=$(INDEXER_DISABLE_WITHDRAWALS_FETCHER)'
endif endif

Loading…
Cancel
Save