Skip to content

Commit

Permalink
Merge pull request #8752 from blockscout/np-add-switcher-for-nft-migr…
Browse files Browse the repository at this point in the history
…ator

Add TOKEN_INSTANCE_OWNER_MIGRATION_ENABLED env
  • Loading branch information
vbaranov committed Oct 31, 2023
2 parents 964fbc8 + 2d9112c commit c472f7b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Fixes

- [#8752](https://github.com/blockscout/blockscout/pull/8752) - Add `TOKEN_INSTANCE_OWNER_MIGRATION_ENABLED` env
- [#8724](https://github.com/blockscout/blockscout/pull/8724) - Fix flaky account notifier test

### Chore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ 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__)
end

@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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit c472f7b

Please sign in to comment.