Ability to disable block reward, coin balance, token updater fetchers

pull/5399/head
Viktor Baranov 3 years ago
parent b05088130a
commit 699b42a1b3
  1. 9
      apps/indexer/config/config.exs
  2. 9
      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,9 +35,13 @@ 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
entries = Enum.map(balance_fields, &entry/1)
if CoinBalanceSupervisor.disabled?() do
:ok
else
entries = Enum.map(balance_fields, &entry/1)
BufferedTask.buffer(__MODULE__, entries)
BufferedTask.buffer(__MODULE__, entries)
end
end
@doc false

Loading…
Cancel
Save