|
|
|
@ -92,21 +92,14 @@ defmodule Indexer.Supervisor do |
|
|
|
|
|
|
|
|
|
realtime_subscribe_named_arguments = realtime_overrides[:subscribe_named_arguments] || subscribe_named_arguments |
|
|
|
|
|
|
|
|
|
realtime_fetcher = |
|
|
|
|
if Application.get_env(:indexer, Realtime.Supervisor)[:enabled] do |
|
|
|
|
[ |
|
|
|
|
{Realtime.Supervisor, |
|
|
|
|
basic_fetchers = |
|
|
|
|
[ |
|
|
|
|
# Root fetchers |
|
|
|
|
{PendingTransaction.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]}, |
|
|
|
|
configure(Realtime.Supervisor, [ |
|
|
|
|
%{block_fetcher: realtime_block_fetcher, subscribe_named_arguments: realtime_subscribe_named_arguments}, |
|
|
|
|
[name: Realtime.Supervisor] |
|
|
|
|
]} |
|
|
|
|
] |
|
|
|
|
else |
|
|
|
|
[] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
basic_fetchers = [ |
|
|
|
|
# Root fetchers |
|
|
|
|
]), |
|
|
|
|
{Catchup.Supervisor, |
|
|
|
|
[ |
|
|
|
|
%{block_fetcher: block_fetcher, block_interval: block_interval, memory_monitor: memory_monitor}, |
|
|
|
@ -115,16 +108,22 @@ defmodule Indexer.Supervisor do |
|
|
|
|
|
|
|
|
|
# Async catchup fetchers |
|
|
|
|
{UncleBlock.Supervisor, [[block_fetcher: block_fetcher, memory_monitor: memory_monitor]]}, |
|
|
|
|
{BlockReward.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{BlockReward.Supervisor, |
|
|
|
|
[[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{InternalTransaction.Supervisor, |
|
|
|
|
[[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{CoinBalance.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{CoinBalance.Supervisor, |
|
|
|
|
[[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{Token.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{TokenInstance.Supervisor, |
|
|
|
|
configure(TokenInstance.Supervisor, [ |
|
|
|
|
[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] |
|
|
|
|
]), |
|
|
|
|
{ContractCode.Supervisor, |
|
|
|
|
[[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{TokenBalance.Supervisor, |
|
|
|
|
[[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{TokenUpdater.Supervisor, |
|
|
|
|
[[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{ContractCode.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{TokenBalance.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{TokenUpdater.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{ReplacedTransaction.Supervisor, [[memory_monitor: memory_monitor]]}, |
|
|
|
|
|
|
|
|
|
# Out-of-band fetchers |
|
|
|
@ -141,17 +140,19 @@ defmodule Indexer.Supervisor do |
|
|
|
|
[[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]]}, |
|
|
|
|
{PendingOpsCleaner, [[], []]} |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
all_fetchers = |
|
|
|
|
[ |
|
|
|
|
{PendingTransaction.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]} |
|
|
|
|
] ++ |
|
|
|
|
realtime_fetcher ++ |
|
|
|
|
basic_fetchers |
|
|
|
|
|> List.flatten() |
|
|
|
|
|
|
|
|
|
Supervisor.init( |
|
|
|
|
all_fetchers, |
|
|
|
|
basic_fetchers, |
|
|
|
|
strategy: :one_for_one |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
defp configure(process, opts \\ []) do |
|
|
|
|
if Application.get_env(:indexer, process)[:enabled] do |
|
|
|
|
[{process, opts}] |
|
|
|
|
else |
|
|
|
|
[] |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|