Add env to disable indexer supervisor

pull/2376/head
saneery 5 years ago
parent 3bda173b6e
commit 1e4de6e41e
  1. 2
      apps/indexer/config/config.exs
  2. 12
      apps/indexer/lib/indexer/application.ex

@ -41,6 +41,8 @@ config :indexer,
# config :indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: true # config :indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: true
config :indexer, Indexer.Fetcher.StakingPools.Supervisor, disabled?: true config :indexer, Indexer.Fetcher.StakingPools.Supervisor, disabled?: true
config :indexer, Indexer.Supervisor, enabled: System.get_env("DISABLE_INDEXER") != "true"
config :indexer, Indexer.Tracer, config :indexer, Indexer.Tracer,
service: :indexer, service: :indexer,
adapter: SpandexDatadog.Adapter, adapter: SpandexDatadog.Adapter,

@ -17,11 +17,17 @@ defmodule Indexer.Application do
memory_monitor_name = Memory.Monitor memory_monitor_name = Memory.Monitor
children = [ base_children = [
{Memory.Monitor, [memory_monitor_options, [name: memory_monitor_name]]}, {Memory.Monitor, [memory_monitor_options, [name: memory_monitor_name]]}
{Indexer.Supervisor, [%{memory_monitor: memory_monitor_name}]}
] ]
children =
if Application.get_env(:indexer, Indexer.Supervisor)[:enabled] do
Enum.reverse([{Indexer.Supervisor, [%{memory_monitor: memory_monitor_name}]} | base_children])
else
base_children
end
opts = [ opts = [
# If the `Memory.Monitor` dies, it needs all the `Shrinkable`s to re-register, so restart them. # If the `Memory.Monitor` dies, it needs all the `Shrinkable`s to re-register, so restart them.
strategy: :rest_for_one, strategy: :rest_for_one,

Loading…
Cancel
Save