diff --git a/apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex b/apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex index 5bb8532fdf..01ca324f5f 100644 --- a/apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex +++ b/apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex @@ -5,7 +5,7 @@ defmodule Explorer.TokenInstanceOwnerAddressMigration.Supervisor do use Supervisor - alias Explorer.TokenInstanceOwnerAddressMigration.{Helper, Worker} + alias Explorer.TokenInstanceOwnerAddressMigration.Worker def start_link(init_arg) do Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__) @@ -13,9 +13,11 @@ defmodule Explorer.TokenInstanceOwnerAddressMigration.Supervisor do @impl true def init(_init_arg) do - if Helper.unfilled_token_instances_exists?() do + params = Application.get_env(:explorer, Explorer.TokenInstanceOwnerAddressMigration) + + if params[:enabled] do children = [ - {Worker, Application.get_env(:explorer, Explorer.TokenInstanceOwnerAddressMigration)} + {Worker, params} ] Supervisor.init(children, strategy: :one_for_one) diff --git a/apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex b/apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex index c0ad7c4879..c9cfabc9d2 100644 --- a/apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex +++ b/apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex @@ -14,7 +14,7 @@ defmodule Explorer.TokenInstanceOwnerAddressMigration.Worker do alias Explorer.Repo alias Explorer.TokenInstanceOwnerAddressMigration.Helper - def start_link(concurrency: concurrency, batch_size: batch_size) do + def start_link(concurrency: concurrency, batch_size: batch_size, enabled: _) do GenServer.start_link(__MODULE__, %{concurrency: concurrency, batch_size: batch_size}, name: __MODULE__) end diff --git a/config/runtime.exs b/config/runtime.exs index 6332d618d0..3bc5336b44 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -433,7 +433,8 @@ config :explorer, Explorer.Chain.Cache.MinMissingBlockNumber, config :explorer, Explorer.TokenInstanceOwnerAddressMigration, concurrency: ConfigHelper.parse_integer_env_var("TOKEN_INSTANCE_OWNER_MIGRATION_CONCURRENCY", 5), - batch_size: ConfigHelper.parse_integer_env_var("TOKEN_INSTANCE_OWNER_MIGRATION_BATCH_SIZE", 50) + batch_size: ConfigHelper.parse_integer_env_var("TOKEN_INSTANCE_OWNER_MIGRATION_BATCH_SIZE", 50), + enabled: ConfigHelper.parse_bool_env_var("TOKEN_INSTANCE_OWNER_MIGRATION_ENABLED") config :explorer, Explorer.Chain.Transaction, rootstock_remasc_address: System.get_env("ROOTSTOCK_REMASC_ADDRESS"),