From 7ea1863d8274c874b180da0374c0e896a5f9b665 Mon Sep 17 00:00:00 2001 From: Nikita Pozdniakov Date: Wed, 19 Apr 2023 22:08:54 +0300 Subject: [PATCH] Refactor Indexer.Fetcher.TokenInstance naming --- .../explorer/token/instance_metadata_retriever.ex | 2 +- apps/indexer/lib/indexer/block/fetcher.ex | 4 ++-- .../{token_instance.ex => token_instance/helper.ex} | 2 +- .../token_instance.ex => token_instance/realtime.ex} | 4 ++-- .../token_instance.ex => token_instance/retry.ex} | 4 ++-- .../token_instance.ex => token_instance/sanitize.ex} | 4 ++-- apps/indexer/lib/indexer/supervisor.ex | 12 ++++++------ config/runtime.exs | 12 ++++++------ 8 files changed, 22 insertions(+), 22 deletions(-) rename apps/indexer/lib/indexer/fetcher/{token_instance.ex => token_instance/helper.ex} (97%) rename apps/indexer/lib/indexer/fetcher/{realtime/token_instance.ex => token_instance/realtime.ex} (95%) rename apps/indexer/lib/indexer/fetcher/{retry/token_instance.ex => token_instance/retry.ex} (95%) rename apps/indexer/lib/indexer/fetcher/{sanitize/token_instance.ex => token_instance/sanitize.ex} (94%) diff --git a/apps/explorer/lib/explorer/token/instance_metadata_retriever.ex b/apps/explorer/lib/explorer/token/instance_metadata_retriever.ex index b3d38281c0..0594e401b5 100644 --- a/apps/explorer/lib/explorer/token/instance_metadata_retriever.ex +++ b/apps/explorer/lib/explorer/token/instance_metadata_retriever.ex @@ -65,7 +65,7 @@ defmodule Explorer.Token.InstanceMetadataRetriever do # https://eips.ethereum.org/EIPS/eip-1155#metadata @erc1155_token_id_placeholder "{id}" - @max_error_length 100 + @max_error_length 255 @ignored_hosts ["localhost", "127.0.0.1", "0.0.0.0", "", nil] diff --git a/apps/indexer/lib/indexer/block/fetcher.ex b/apps/indexer/lib/indexer/block/fetcher.ex index cfa42e49f5..867fef4604 100644 --- a/apps/indexer/lib/indexer/block/fetcher.ex +++ b/apps/indexer/lib/indexer/block/fetcher.ex @@ -22,10 +22,10 @@ defmodule Indexer.Block.Fetcher do CoinBalance, ContractCode, InternalTransaction, - Realtime.TokenInstance, ReplacedTransaction, Token, TokenBalance, + TokenInstance.Realtime, UncleBlock } @@ -253,7 +253,7 @@ defmodule Indexer.Block.Fetcher do end def async_import_token_instances(%{token_transfers: token_transfers}) do - TokenInstance.async_fetch(token_transfers) + Realtime.async_fetch(token_transfers) end def async_import_token_instances(_), do: :ok diff --git a/apps/indexer/lib/indexer/fetcher/token_instance.ex b/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex similarity index 97% rename from apps/indexer/lib/indexer/fetcher/token_instance.ex rename to apps/indexer/lib/indexer/fetcher/token_instance/helper.ex index 4a275e22e8..4314e89900 100644 --- a/apps/indexer/lib/indexer/fetcher/token_instance.ex +++ b/apps/indexer/lib/indexer/fetcher/token_instance/helper.ex @@ -1,4 +1,4 @@ -defmodule Indexer.Fetcher.TokenInstance do +defmodule Indexer.Fetcher.TokenInstance.Helper do @moduledoc """ Common functions for Indexer.Fetcher.TokenInstance fetchers """ diff --git a/apps/indexer/lib/indexer/fetcher/realtime/token_instance.ex b/apps/indexer/lib/indexer/fetcher/token_instance/realtime.ex similarity index 95% rename from apps/indexer/lib/indexer/fetcher/realtime/token_instance.ex rename to apps/indexer/lib/indexer/fetcher/token_instance/realtime.ex index 8d0185ff6f..3ab1e12200 100644 --- a/apps/indexer/lib/indexer/fetcher/realtime/token_instance.ex +++ b/apps/indexer/lib/indexer/fetcher/token_instance/realtime.ex @@ -1,4 +1,4 @@ -defmodule Indexer.Fetcher.Realtime.TokenInstance do +defmodule Indexer.Fetcher.TokenInstance.Realtime do @moduledoc """ Fetches information about a token instance. """ @@ -6,7 +6,7 @@ defmodule Indexer.Fetcher.Realtime.TokenInstance do use Indexer.Fetcher, restart: :permanent use Spandex.Decorators - import Indexer.Fetcher.TokenInstance + import Indexer.Fetcher.TokenInstance.Helper alias Explorer.Chain alias Indexer.BufferedTask diff --git a/apps/indexer/lib/indexer/fetcher/retry/token_instance.ex b/apps/indexer/lib/indexer/fetcher/token_instance/retry.ex similarity index 95% rename from apps/indexer/lib/indexer/fetcher/retry/token_instance.ex rename to apps/indexer/lib/indexer/fetcher/token_instance/retry.ex index 7a4f643e8d..e6192a46cd 100644 --- a/apps/indexer/lib/indexer/fetcher/retry/token_instance.ex +++ b/apps/indexer/lib/indexer/fetcher/token_instance/retry.ex @@ -1,4 +1,4 @@ -defmodule Indexer.Fetcher.Retry.TokenInstance do +defmodule Indexer.Fetcher.TokenInstance.Retry do @moduledoc """ Fetches information about a token instance. """ @@ -6,7 +6,7 @@ defmodule Indexer.Fetcher.Retry.TokenInstance do use Indexer.Fetcher, restart: :permanent use Spandex.Decorators - import Indexer.Fetcher.TokenInstance + import Indexer.Fetcher.TokenInstance.Helper alias Explorer.Chain alias Indexer.BufferedTask diff --git a/apps/indexer/lib/indexer/fetcher/sanitize/token_instance.ex b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize.ex similarity index 94% rename from apps/indexer/lib/indexer/fetcher/sanitize/token_instance.ex rename to apps/indexer/lib/indexer/fetcher/token_instance/sanitize.ex index 9b355cb3b2..9cf6ff041a 100644 --- a/apps/indexer/lib/indexer/fetcher/sanitize/token_instance.ex +++ b/apps/indexer/lib/indexer/fetcher/token_instance/sanitize.ex @@ -1,4 +1,4 @@ -defmodule Indexer.Fetcher.Sanitize.TokenInstance do +defmodule Indexer.Fetcher.TokenInstance.Sanitize do @moduledoc """ Fetches information about a token instance. """ @@ -6,7 +6,7 @@ defmodule Indexer.Fetcher.Sanitize.TokenInstance do use Indexer.Fetcher, restart: :permanent use Spandex.Decorators - import Indexer.Fetcher.TokenInstance + import Indexer.Fetcher.TokenInstance.Helper alias Explorer.Chain alias Indexer.BufferedTask diff --git a/apps/indexer/lib/indexer/supervisor.ex b/apps/indexer/lib/indexer/supervisor.ex index f34c27460c..6f8f55dc61 100644 --- a/apps/indexer/lib/indexer/supervisor.ex +++ b/apps/indexer/lib/indexer/supervisor.ex @@ -22,12 +22,12 @@ defmodule Indexer.Supervisor do InternalTransaction, PendingBlockOperationsSanitizer, PendingTransaction, - Realtime, ReplacedTransaction, - Retry, - Sanitize, Token, TokenBalance, + TokenInstance.Realtime, + TokenInstance.Retry, + TokenInstance.Sanitize, TokenUpdater, TransactionAction, UncleBlock @@ -109,15 +109,15 @@ 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]]}, - {Retry.TokenInstance.Supervisor, + {Retry.Supervisor, [ [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] ]}, - {Realtime.TokenInstance.Supervisor, + {Realtime.Supervisor, [ [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] ]}, - {Sanitize.TokenInstance.Supervisor, + {Sanitize.Supervisor, [ [json_rpc_named_arguments: json_rpc_named_arguments, memory_monitor: memory_monitor] ]}, diff --git a/config/runtime.exs b/config/runtime.exs index 6174173dba..11a073789b 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -435,13 +435,13 @@ config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer.Supervisor, config :indexer, Indexer.Block.Realtime.Supervisor, enabled: !ConfigHelper.parse_bool_env_var("DISABLE_REALTIME_INDEXER") -config :indexer, Indexer.Fetcher.Realtime.TokenInstance.Supervisor, +config :indexer, Indexer.Fetcher.TokenInstance.Realtime.Supervisor, disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_REALTIME_FETCHER") -config :indexer, Indexer.Fetcher.Retry.TokenInstance.Supervisor, +config :indexer, Indexer.Fetcher.TokenInstance.Retry.Supervisor, disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_RETRY_FETCHER") -config :indexer, Indexer.Fetcher.Sanitize.TokenInstance.Supervisor, +config :indexer, Indexer.Fetcher.TokenInstance.Sanitize.Supervisor, disabled?: ConfigHelper.parse_bool_env_var("INDEXER_DISABLE_TOKEN_INSTANCE_SANITIZE_FETCHER") config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer, @@ -458,14 +458,14 @@ config :indexer, Indexer.Fetcher.BlockReward, batch_size: ConfigHelper.parse_integer_env_var("INDEXER_BLOCK_REWARD_BATCH_SIZE", 10), concurrency: ConfigHelper.parse_integer_env_var("INDEXER_BLOCK_REWARD_CONCURRENCY", 4) -config :indexer, Indexer.Fetcher.Retry.TokenInstance, +config :indexer, Indexer.Fetcher.TokenInstance.Retry, concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_RETRY_CONCURRENCY", 10), refetch_interval: ConfigHelper.parse_time_env_var("INDEXER_TOKEN_INSTANCE_RETRY_REFETCH_INTERVAL", "24h") -config :indexer, Indexer.Fetcher.Realtime.TokenInstance, +config :indexer, Indexer.Fetcher.TokenInstance.Realtime, concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_REALTIME_CONCURRENCY", 10) -config :indexer, Indexer.Fetcher.Sanitize.TokenInstance, +config :indexer, Indexer.Fetcher.TokenInstance.Sanitize, concurrency: ConfigHelper.parse_integer_env_var("INDEXER_TOKEN_INSTANCE_SANITIZE_CONCURRENCY", 10) config :indexer, Indexer.Fetcher.InternalTransaction,