diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index 922255184f..a97197e1d5 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -27,7 +27,7 @@ config :explorer, Explorer.Counters.AverageBlockTime, enabled: true, period: average_block_period -config :explorer, Explorer.ChainSpec.GenesisData, chain_spec_path: System.get_env("CHAIN_SPEC_PATH") +config :explorer, Explorer.ChainSpec.GenesisData, enabled: true, chain_spec_path: System.get_env("CHAIN_SPEC_PATH") config :explorer, Explorer.Chain.Cache.BlockNumber, enabled: true diff --git a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex index 6d33d27b3e..e34cbc0504 100644 --- a/apps/explorer/lib/explorer/chain_spec/genesis_data.ex +++ b/apps/explorer/lib/explorer/chain_spec/genesis_data.ex @@ -11,9 +11,14 @@ defmodule Explorer.ChainSpec.GenesisData do @interval :timer.minutes(2) + def start_link(opts) do + GenServer.start_link(__MODULE__, opts, name: __MODULE__) + end + @impl GenServer def init(_) do :timer.send_interval(@interval, :import) + Process.send_after(self(), :import, @interval) {:ok, %{}} end @@ -58,6 +63,8 @@ defmodule Explorer.ChainSpec.GenesisData do {:ok, _} = Importer.import_genesis_coin_balances(chain_spec) end) + else + Logger.warn(fn -> "Failed to fetch genesis data. Chain spec path is not set." end) end end end