Merge branch 'master' into realtime-separate-node-configuration

pull/1567/head
Victor Baranov 6 years ago committed by GitHub
commit 7c2c85182d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/indexer/config/config.exs
  2. 7
      apps/indexer/lib/indexer/block/reward/fetcher.ex
  3. 10
      apps/indexer/lib/indexer/block/reward/supervisor.ex

@ -36,6 +36,7 @@ config :indexer,
memory_limit: 1 <<< 30
# config :indexer, Indexer.ReplacedTransaction.Supervisor, disabled?: true
# config :indexer, Indexer.Block.Reward.Supervisor, disabled?: true
config :indexer, Indexer.Tracer,
service: :indexer,

@ -18,6 +18,7 @@ defmodule Indexer.Block.Reward.Fetcher do
alias Explorer.Chain.{Block, Wei}
alias Indexer.Address.CoinBalances
alias Indexer.{AddressExtraction, BufferedTask, CoinBalance, Tracer}
alias Indexer.Block.Reward.Supervisor, as: BlockRewardSupervisor
@behaviour BufferedTask
@ -34,7 +35,11 @@ defmodule Indexer.Block.Reward.Fetcher do
"""
@spec async_fetch([Block.block_number()]) :: :ok
def async_fetch(block_numbers) when is_list(block_numbers) do
BufferedTask.buffer(__MODULE__, block_numbers)
if BlockRewardSupervisor.disabled?() do
:ok
else
BufferedTask.buffer(__MODULE__, block_numbers)
end
end
@doc false

@ -22,7 +22,15 @@ defmodule Indexer.Block.Reward.Supervisor do
end
def start_link(arguments, gen_server_options \\ []) do
Supervisor.start_link(__MODULE__, arguments, Keyword.put_new(gen_server_options, :name, __MODULE__))
if disabled?() do
:ignore
else
Supervisor.start_link(__MODULE__, arguments, Keyword.put_new(gen_server_options, :name, __MODULE__))
end
end
def disabled?() do
Application.get_env(:indexer, __MODULE__, [])[:disabled?] == true
end
@impl Supervisor

Loading…
Cancel
Save