Fix DISABLE_TOKEN_INSTANCE_FETCHER env

pull/6276/head
Qwerty5Uiop 2 years ago
parent 712a784b8a
commit dc2ea8d70a
  1. 10
      apps/indexer/lib/indexer/fetcher/token_instance.ex
  2. 9
      apps/indexer/lib/indexer/supervisor.ex
  3. 2
      config/runtime.exs

@ -153,7 +153,13 @@ defmodule Indexer.Fetcher.TokenInstance do
@doc """
Fetches token instance data asynchronously.
"""
def async_fetch(token_transfers) when is_list(token_transfers) do
def async_fetch(data) do
async_fetch(data, __MODULE__.Supervisor.disabled?())
end
def async_fetch(_data, true), do: :ok
def async_fetch(token_transfers, _disabled?) when is_list(token_transfers) do
data =
token_transfers
|> Enum.reject(fn token_transfer -> is_nil(token_transfer.token_id) and is_nil(token_transfer.token_ids) end)
@ -169,7 +175,7 @@ defmodule Indexer.Fetcher.TokenInstance do
BufferedTask.buffer(__MODULE__, data)
end
def async_fetch(data) do
def async_fetch(data, _disabled?) do
BufferedTask.buffer(__MODULE__, data)
end
end

@ -115,9 +115,10 @@ defmodule Indexer.Supervisor do
{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]]},
configure(TokenInstance.Supervisor, [
[json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor]
]),
{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,
@ -148,7 +149,7 @@ defmodule Indexer.Supervisor do
)
end
defp configure(process, opts \\ []) do
defp configure(process, opts) do
if Application.get_env(:indexer, process)[:enabled] do
[{process, opts}]
else

@ -439,7 +439,7 @@ 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"
disabled?: System.get_env("DISABLE_TOKEN_INSTANCE_FETCHER", "false") == "true"
blocks_catchup_fetcher_batch_size_default_str = "10"
blocks_catchup_fetcher_concurrency_default_str = "10"

Loading…
Cancel
Save