Merge pull request #6257 from blockscout/disable-instance-fetcher-env

DISABLE_TOKEN_INSTANCE_FETCHER env
pull/6259/head
Victor Baranov 2 years ago committed by GitHub
commit 1e99c98ac3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 53
      apps/indexer/lib/indexer/supervisor.ex
  3. 3
      config/runtime.exs
  4. 1
      docker-compose/envs/common-blockscout.env
  5. 3
      docker/Makefile

@ -9,6 +9,7 @@
- [#6111](https://github.com/blockscout/blockscout/pull/6111) - Add Prometheus metrics to indexer
- [#6168](https://github.com/blockscout/blockscout/pull/6168) - Token instance fetcher checks instance owner and updates current token balance
- [#6209](https://github.com/blockscout/blockscout/pull/6209) - Add metrics for block import stages, runners, steps
- [#6257](https://github.com/blockscout/blockscout/pull/6257) - DISABLE_TOKEN_INSTANCE_FETCHER env variable
### Fixes

@ -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

@ -438,6 +438,9 @@ config :indexer, Indexer.Supervisor, enabled: System.get_env("DISABLE_INDEXER")
config :indexer, Indexer.Block.Realtime.Supervisor, enabled: System.get_env("DISABLE_REALTIME_INDEXER") != "true"
config :indexer, Indexer.Fetcher.TokenInstance.Supervisor,
enabled: System.get_env("DISABLE_TOKEN_INSTANCE_FETCHER") != "true"
blocks_catchup_fetcher_batch_size_default_str = "10"
blocks_catchup_fetcher_concurrency_default_str = "10"

@ -79,6 +79,7 @@ DISABLE_READ_API=false
DISABLE_WRITE_API=false
DISABLE_INDEXER=false
DISABLE_REALTIME_INDEXER=false
DISABLE_TOKEN_INSTANCE_FETCHER=false
INDEXER_DISABLE_PENDING_TRANSACTIONS_FETCHER=false
INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=false
# INDEXER_CATCHUP_BLOCKS_BATCH_SIZE=

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

Loading…
Cancel
Save