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. 27
      apps/indexer/lib/indexer/block/uncle/fetcher.ex

@ -82,18 +82,35 @@ defmodule Indexer.Block.Uncle.Fetcher do
addresses_params =
AddressExtraction.extract_addresses(%{blocks: blocks_params, transactions: transactions_params})
{:ok, _} =
Block.Fetcher.import(block_fetcher, %{
case Block.Fetcher.import(block_fetcher, %{
addresses: %{params: addresses_params},
blocks: %{params: blocks_params},
block_second_degree_relations: %{params: block_second_degree_relations_params},
transactions: %{params: transactions_params, on_conflict: :nothing}
})
}) do
{: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} ->
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}
end
end

Loading…
Cancel
Save