Merge branch 'master' into ab-creates-param

pull/1581/head
Ayrat Badykov 6 years ago committed by GitHub
commit 8f43aff4da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      apps/indexer/config/dev/parity.exs
  2. 15
      apps/indexer/lib/indexer/block/supervisor.ex
  3. 3
      apps/indexer/lib/indexer/shrinkable/supervisor.ex

@ -16,6 +16,23 @@ config :indexer,
], ],
variant: EthereumJSONRPC.Parity variant: EthereumJSONRPC.Parity
], ],
# Example configuration to override json_rpc_named_arguments for just the realtime block fetcher
# realtime_overrides: [
# json_rpc_named_arguments: [
# transport: EthereumJSONRPC.HTTP,
# transport_options: [
# http: EthereumJSONRPC.HTTP.HTTPoison,
# url: System.get_env("ETHEREUM_JSONRPC_REALTIME_HTTP_URL") || "http://localhost:8545",
# method_to_url: [
# eth_getBalance: System.get_env("ETHEREUM_JSONRPC_REALTIME_TRACE_URL") || "http://localhost:8545",
# trace_block: System.get_env("ETHEREUM_JSONRPC_REALTIME_TRACE_URL") || "http://localhost:8545",
# trace_replayTransaction: System.get_env("ETHEREUM_JSONRPC_REALTIME_TRACE_URL") || "http://localhost:8545"
# ],
# http_options: [recv_timeout: :timer.minutes(1), timeout: :timer.minutes(1), hackney: [pool: :ethereum_jsonrpc]]
# ],
# variant: EthereumJSONRPC.Parity
# ]
# ],
subscribe_named_arguments: [ subscribe_named_arguments: [
transport: EthereumJSONRPC.WebSocket, transport: EthereumJSONRPC.WebSocket,
transport_options: [ transport_options: [

@ -18,14 +18,23 @@ defmodule Indexer.Block.Supervisor do
%{ %{
block_interval: block_interval, block_interval: block_interval,
json_rpc_named_arguments: json_rpc_named_arguments, json_rpc_named_arguments: json_rpc_named_arguments,
subscribe_named_arguments: subscribe_named_arguments subscribe_named_arguments: subscribe_named_arguments,
realtime_overrides: realtime_overrides
} = named_arguments } = named_arguments
) do ) do
block_fetcher = block_fetcher =
named_arguments named_arguments
|> Map.drop(~w(block_interval memory_monitor subscribe_named_arguments)a) |> Map.drop(~w(block_interval memory_monitor subscribe_named_arguments realtime_overrides)a)
|> Block.Fetcher.new() |> Block.Fetcher.new()
realtime_block_fetcher =
named_arguments
|> Map.drop(~w(block_interval memory_monitor subscribe_named_arguments realtime_overrides)a)
|> Map.merge(Enum.into(realtime_overrides, %{}))
|> Block.Fetcher.new()
realtime_subscribe_named_arguments = realtime_overrides[:subscribe_named_arguments] || subscribe_named_arguments
memory_monitor = Map.get(named_arguments, :memory_monitor) memory_monitor = Map.get(named_arguments, :memory_monitor)
Supervisor.init( Supervisor.init(
@ -38,7 +47,7 @@ defmodule Indexer.Block.Supervisor do
{InvalidConsensus.Supervisor, [[], [name: InvalidConsensus.Supervisor]]}, {InvalidConsensus.Supervisor, [[], [name: InvalidConsensus.Supervisor]]},
{Realtime.Supervisor, {Realtime.Supervisor,
[ [
%{block_fetcher: block_fetcher, subscribe_named_arguments: subscribe_named_arguments}, %{block_fetcher: realtime_block_fetcher, subscribe_named_arguments: realtime_subscribe_named_arguments},
[name: Realtime.Supervisor] [name: Realtime.Supervisor]
]}, ]},
{Uncle.Supervisor, [[block_fetcher: block_fetcher, memory_monitor: memory_monitor], [name: Uncle.Supervisor]]}, {Uncle.Supervisor, [[block_fetcher: block_fetcher, memory_monitor: memory_monitor], [name: Uncle.Supervisor]]},

@ -48,10 +48,11 @@ defmodule Indexer.Shrinkable.Supervisor do
|> Application.get_all_env() |> Application.get_all_env()
|> Keyword.take( |> Keyword.take(
~w(blocks_batch_size blocks_concurrency block_interval json_rpc_named_arguments receipts_batch_size ~w(blocks_batch_size blocks_concurrency block_interval json_rpc_named_arguments receipts_batch_size
receipts_concurrency subscribe_named_arguments)a receipts_concurrency subscribe_named_arguments realtime_overrides)a
) )
|> Enum.into(%{}) |> Enum.into(%{})
|> Map.put(:memory_monitor, memory_monitor) |> Map.put(:memory_monitor, memory_monitor)
|> Map.put_new(:realtime_overrides, %{})
Supervisor.init( Supervisor.init(
[ [

Loading…
Cancel
Save