Add TOKEN_INSTANCE_OWNER_MIGRATION_ENABLED env

np-add-switcher-for-nft-migrator
Nikita Pozdniakov 1 year ago
parent 76846bc31c
commit 240376b9eb
No known key found for this signature in database
GPG Key ID: F344106F9804FE5F
  1. 8
      apps/explorer/lib/explorer/token_instance_owner_address_migration/supervisor.ex
  2. 2
      apps/explorer/lib/explorer/token_instance_owner_address_migration/worker.ex
  3. 3
      config/runtime.exs

@ -5,7 +5,7 @@ defmodule Explorer.TokenInstanceOwnerAddressMigration.Supervisor do
use Supervisor use Supervisor
alias Explorer.TokenInstanceOwnerAddressMigration.{Helper, Worker} alias Explorer.TokenInstanceOwnerAddressMigration.Worker
def start_link(init_arg) do def start_link(init_arg) do
Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__) Supervisor.start_link(__MODULE__, init_arg, name: __MODULE__)
@ -13,9 +13,11 @@ defmodule Explorer.TokenInstanceOwnerAddressMigration.Supervisor do
@impl true @impl true
def init(_init_arg) do def init(_init_arg) do
if Helper.unfilled_token_instances_exists?() do params = Application.get_env(:explorer, Explorer.TokenInstanceOwnerAddressMigration)
if params[:enabled] do
children = [ children = [
{Worker, Application.get_env(:explorer, Explorer.TokenInstanceOwnerAddressMigration)} {Worker, params}
] ]
Supervisor.init(children, strategy: :one_for_one) Supervisor.init(children, strategy: :one_for_one)

@ -14,7 +14,7 @@ defmodule Explorer.TokenInstanceOwnerAddressMigration.Worker do
alias Explorer.Repo alias Explorer.Repo
alias Explorer.TokenInstanceOwnerAddressMigration.Helper 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__) GenServer.start_link(__MODULE__, %{concurrency: concurrency, batch_size: batch_size}, name: __MODULE__)
end end

@ -433,7 +433,8 @@ config :explorer, Explorer.Chain.Cache.MinMissingBlockNumber,
config :explorer, Explorer.TokenInstanceOwnerAddressMigration, config :explorer, Explorer.TokenInstanceOwnerAddressMigration,
concurrency: ConfigHelper.parse_integer_env_var("TOKEN_INSTANCE_OWNER_MIGRATION_CONCURRENCY", 5), 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, config :explorer, Explorer.Chain.Transaction,
rootstock_remasc_address: System.get_env("ROOTSTOCK_REMASC_ADDRESS"), rootstock_remasc_address: System.get_env("ROOTSTOCK_REMASC_ADDRESS"),

Loading…
Cancel
Save