Add CoinBalance fetcher init query limit

pull/7996/head
Qwerty5Uiop 1 year ago
parent 98cd35abe0
commit 7afe8e19b5
  1. 1
      CHANGELOG.md
  2. 10
      apps/explorer/lib/explorer/chain.ex
  3. 3
      apps/indexer/lib/indexer/fetcher/coin_balance.ex
  4. 4
      config/runtime.exs
  5. 1
      docker-compose/envs/common-blockscout.env

@ -5,6 +5,7 @@
### Features
- [#8180](https://github.com/blockscout/blockscout/pull/8180) - Deposits and Withdrawals for Polygon Edge
- [#7996](https://github.com/blockscout/blockscout/pull/7996) - Add CoinBalance fetcher init query limit
### Fixes

@ -2232,7 +2232,7 @@ defmodule Explorer.Chain do
)
query
|> add_fetcher_limit(limited?)
|> add_coin_balances_fetcher_limit(limited?)
|> Repo.stream_reduce(initial, reducer)
end
@ -6315,6 +6315,14 @@ defmodule Explorer.Chain do
limit(query, ^token_balances_fetcher_limit)
end
defp add_coin_balances_fetcher_limit(query, false), do: query
defp add_coin_balances_fetcher_limit(query, true) do
coin_balances_fetcher_limit = Application.get_env(:indexer, :coin_balances_fetcher_init_limit)
limit(query, ^coin_balances_fetcher_limit)
end
def put_has_token_transfers_to_tx(query, true), do: query
def put_has_token_transfers_to_tx(query, false) do

@ -69,7 +69,8 @@ defmodule Indexer.Fetcher.CoinBalance do
address_fields
|> entry()
|> reducer.(acc)
end
end,
true
)
final

@ -431,7 +431,9 @@ config :indexer,
hide_indexing_progress_alert: ConfigHelper.parse_bool_env_var("INDEXER_HIDE_INDEXING_PROGRESS_ALERT"),
fetcher_init_limit: ConfigHelper.parse_integer_env_var("INDEXER_FETCHER_INIT_QUERY_LIMIT", 100),
token_balances_fetcher_init_limit:
ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT", 100_000)
ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT", 100_000),
coin_balances_fetcher_init_limit:
ConfigHelper.parse_integer_env_var("INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT", 2000)
config :indexer, Indexer.Supervisor, enabled: !ConfigHelper.parse_bool_env_var("DISABLE_INDEXER")

@ -139,6 +139,7 @@ INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
# INDEXER_REALTIME_FETCHER_MAX_GAP=
# INDEXER_FETCHER_INIT_QUERY_LIMIT=
# INDEXER_TOKEN_BALANCES_FETCHER_INIT_QUERY_LIMIT=
# INDEXER_COIN_BALANCES_FETCHER_INIT_QUERY_LIMIT=
# INDEXER_DISABLE_WITHDRAWALS_FETCHER=
# WITHDRAWALS_FIRST_BLOCK=
# TOKEN_ID_MIGRATION_FIRST_BLOCK=

Loading…
Cancel
Save