Merge pull request #5742 from blockscout/realtime-fetcher-disable-env

Disable realtime fetcher by env
pull/5730/head
Victor Baranov 2 years ago committed by GitHub
commit ef43da6d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      apps/indexer/config/config.exs
  2. 28
      apps/indexer/lib/indexer/supervisor.ex
  3. 1
      docker-compose/envs/common-blockscout.env
  4. 3
      docker/Makefile

@ -82,6 +82,8 @@ config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer.Supervisor,
config :indexer, Indexer.Supervisor, enabled: System.get_env("DISABLE_INDEXER") != "true" config :indexer, Indexer.Supervisor, enabled: System.get_env("DISABLE_INDEXER") != "true"
config :indexer, Indexer.Block.Realtime.Supervisor, enabled: System.get_env("DISABLE_REALTIME_INDEXER") != "true"
config :indexer, Indexer.Tracer, config :indexer, Indexer.Tracer,
service: :indexer, service: :indexer,
adapter: SpandexDatadog.Adapter, adapter: SpandexDatadog.Adapter,

@ -92,14 +92,21 @@ defmodule Indexer.Supervisor do
realtime_subscribe_named_arguments = realtime_overrides[:subscribe_named_arguments] || subscribe_named_arguments 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,
[
%{block_fetcher: realtime_block_fetcher, subscribe_named_arguments: realtime_subscribe_named_arguments},
[name: Realtime.Supervisor]
]}
]
else
[]
end
basic_fetchers = [ basic_fetchers = [
# Root fetchers # Root fetchers
{PendingTransaction.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]},
{Realtime.Supervisor,
[
%{block_fetcher: realtime_block_fetcher, subscribe_named_arguments: realtime_subscribe_named_arguments},
[name: Realtime.Supervisor]
]},
{Catchup.Supervisor, {Catchup.Supervisor,
[ [
%{block_fetcher: block_fetcher, block_interval: block_interval, memory_monitor: memory_monitor}, %{block_fetcher: block_fetcher, block_interval: block_interval, memory_monitor: memory_monitor},
@ -135,8 +142,15 @@ defmodule Indexer.Supervisor do
{PendingOpsCleaner, [[], []]} {PendingOpsCleaner, [[], []]}
] ]
all_fetchers =
[
{PendingTransaction.Supervisor, [[json_rpc_named_arguments: json_rpc_named_arguments]]}
] ++
realtime_fetcher ++
basic_fetchers
Supervisor.init( Supervisor.init(
basic_fetchers, all_fetchers,
strategy: :one_for_one strategy: :one_for_one
) )
end end

@ -75,6 +75,7 @@ DISABLE_WEBAPP=false
DISABLE_READ_API=false DISABLE_READ_API=false
DISABLE_WRITE_API=false DISABLE_WRITE_API=false
DISABLE_INDEXER=false DISABLE_INDEXER=false
DISABLE_REALTIME_INDEXER=false
INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=false INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=false
INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
# WEBAPP_URL= # WEBAPP_URL=

@ -172,6 +172,9 @@ endif
ifdef DISABLE_INDEXER ifdef DISABLE_INDEXER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_INDEXER=$(DISABLE_INDEXER)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_INDEXER=$(DISABLE_INDEXER)'
endif endif
ifdef DISABLE_REALTIME_INDEXER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'DISABLE_REALTIME_INDEXER=$(DISABLE_REALTIME_INDEXER)'
endif
ifdef WEBAPP_URL ifdef WEBAPP_URL
BLOCKSCOUT_CONTAINER_PARAMS += -e 'WEBAPP_URL=$(WEBAPP_URL)' BLOCKSCOUT_CONTAINER_PARAMS += -e 'WEBAPP_URL=$(WEBAPP_URL)'
endif endif

Loading…
Cancel
Save