|
|
@ -87,13 +87,13 @@ defmodule Explorer.Indexer.BlockFetcher do |
|
|
|
|
|
|
|
|
|
|
|
@impl GenServer |
|
|
|
@impl GenServer |
|
|
|
def handle_info(:catchup_index, %{} = state) do |
|
|
|
def handle_info(:catchup_index, %{} = state) do |
|
|
|
{:ok, genesis_task, _ref} = monitor_task(fn -> genesis_task(state) end) |
|
|
|
{:ok, genesis_task, _ref} = Indexer.start_monitor(fn -> genesis_task(state) end) |
|
|
|
|
|
|
|
|
|
|
|
{:noreply, %{state | genesis_task: genesis_task}} |
|
|
|
{:noreply, %{state | genesis_task: genesis_task}} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def handle_info(:realtime_index, %{} = state) do |
|
|
|
def handle_info(:realtime_index, %{} = state) do |
|
|
|
{:ok, realtime_task, _ref} = monitor_task(fn -> realtime_task(state) end) |
|
|
|
{:ok, realtime_task, _ref} = Indexer.start_monitor(fn -> realtime_task(state) end) |
|
|
|
|
|
|
|
|
|
|
|
{:noreply, %{state | realtime_task: realtime_task}} |
|
|
|
{:noreply, %{state | realtime_task: realtime_task}} |
|
|
|
end |
|
|
|
end |
|
|
@ -315,10 +315,4 @@ defmodule Explorer.Indexer.BlockFetcher do |
|
|
|
Process.send_after(self(), :realtime_index, state.realtime_interval) |
|
|
|
Process.send_after(self(), :realtime_index, state.realtime_interval) |
|
|
|
state |
|
|
|
state |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
defp monitor_task(task_func) do |
|
|
|
|
|
|
|
{:ok, pid} = Task.Supervisor.start_child(Indexer.TaskSupervisor, task_func) |
|
|
|
|
|
|
|
ref = Process.monitor(pid) |
|
|
|
|
|
|
|
{:ok, pid, ref} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|