Merge branch 'master' into ab-add-contract-code

pull/1577/head
Ayrat Badykov 6 years ago committed by GitHub
commit 529ef67ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      README.md
  2. 1
      apps/indexer/config/config.exs
  3. 7
      apps/indexer/lib/indexer/block/reward/fetcher.ex
  4. 10
      apps/indexer/lib/indexer/block/reward/supervisor.ex

@ -59,6 +59,7 @@ Currently available block explorers (i.e. Etherscan and Etherchain) are closed s
* [Fuse Network](https://explorer.fuse.io/) * [Fuse Network](https://explorer.fuse.io/)
* [ARTIS](https://explorer.sigma1.artis.network) * [ARTIS](https://explorer.sigma1.artis.network)
* [SafeChain](https://explorer.safechain.io) * [SafeChain](https://explorer.safechain.io)
* [SpringChain](https://explorer.springrole.com/)
### Visual Interface ### Visual Interface

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

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

@ -22,7 +22,15 @@ defmodule Indexer.Block.Reward.Supervisor do
end end
def start_link(arguments, gen_server_options \\ []) do 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 end
@impl Supervisor @impl Supervisor

Loading…
Cancel
Save