Merge pull request #923 from poanetwork/919

Log and retry import errors in uncle fetcher
pull/925/head
Luke Imhoff 6 years ago committed by GitHub
commit 42d03efcac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      apps/indexer/lib/indexer/block/uncle/fetcher.ex

@ -82,18 +82,35 @@ defmodule Indexer.Block.Uncle.Fetcher do
addresses_params = addresses_params =
AddressExtraction.extract_addresses(%{blocks: blocks_params, transactions: transactions_params}) AddressExtraction.extract_addresses(%{blocks: blocks_params, transactions: transactions_params})
{:ok, _} = case Block.Fetcher.import(block_fetcher, %{
Block.Fetcher.import(block_fetcher, %{ addresses: %{params: addresses_params},
addresses: %{params: addresses_params}, blocks: %{params: blocks_params},
blocks: %{params: blocks_params}, block_second_degree_relations: %{params: block_second_degree_relations_params},
block_second_degree_relations: %{params: block_second_degree_relations_params}, transactions: %{params: transactions_params, on_conflict: :nothing}
transactions: %{params: transactions_params, on_conflict: :nothing} }) do
}) {:ok, _} ->
:ok
:ok
{:error, step, failed_value, _changes_so_far} ->
Logger.error(fn ->
[
"failed to import ",
unique_hashes |> length() |> to_string(),
"uncle blocks in step ",
inspect(step),
": ",
inspect(failed_value)
]
end)
{:retry, unique_hashes}
end
{:error, reason} -> {:error, reason} ->
Logger.debug(fn -> "failed to fetch #{length(unique_hashes)} uncle blocks, #{inspect(reason)}" end) Logger.error(fn ->
["failed to fetch ", unique_hashes |> length |> to_string(), " uncle blocks: ", inspect(reason)]
end)
{:retry, unique_hashes} {:retry, unique_hashes}
end end
end end

Loading…
Cancel
Save