Merge pull request #5399 from blockscout/vb-disable-fetchers

Ability to disable block reward, coin balance, token updater fetchers
pull/5407/head
Victor Baranov 3 years ago committed by GitHub
commit 98b0b69c4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      apps/indexer/config/config.exs
  2. 5
      apps/indexer/lib/indexer/fetcher/coin_balance.ex

@ -69,12 +69,19 @@ config :indexer, Indexer.Fetcher.CoinBalanceOnDemand, threshold: coin_balance_on
if System.get_env("POS_STAKING_CONTRACT") do
config :indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: true
else
config :indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: false
config :indexer, Indexer.Fetcher.BlockReward.Supervisor,
disabled?: System.get_env("INDEXER_DISABLE_BLOCK_REWARD_FETCHER", "false") == "true"
end
config :indexer, Indexer.Fetcher.InternalTransaction.Supervisor,
disabled?: System.get_env("INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER", "false") == "true"
config :indexer, Indexer.Fetcher.CoinBalance.Supervisor,
disabled?: System.get_env("INDEXER_DISABLE_ADDRESS_COIN_BALANCE_FETCHER", "false") == "true"
config :indexer, Indexer.Fetcher.TokenUpdater.Supervisor,
disabled?: System.get_env("INDEXER_DISABLE_CATALOGED_TOKEN_UPDATER_FETCHER", "false") == "true"
config :indexer, Indexer.Supervisor, enabled: System.get_env("DISABLE_INDEXER") != "true"
config :indexer, Indexer.Tracer,

@ -16,6 +16,7 @@ defmodule Indexer.Fetcher.CoinBalance do
alias Explorer.Chain.{Block, Hash}
alias Explorer.Chain.Cache.Accounts
alias Indexer.{BufferedTask, Tracer}
alias Indexer.Fetcher.CoinBalance.Supervisor, as: CoinBalanceSupervisor
@behaviour BufferedTask
@ -34,10 +35,14 @@ defmodule Indexer.Fetcher.CoinBalance do
%{required(:address_hash) => Hash.Address.t(), required(:block_number) => Block.block_number()}
]) :: :ok
def async_fetch_balances(balance_fields) when is_list(balance_fields) do
if CoinBalanceSupervisor.disabled?() do
:ok
else
entries = Enum.map(balance_fields, &entry/1)
BufferedTask.buffer(__MODULE__, entries)
end
end
@doc false
# credo:disable-for-next-line Credo.Check.Design.DuplicatedCode

Loading…
Cancel
Save