|
|
|
@ -277,6 +277,8 @@ defmodule Indexer.Fetcher.InternalTransaction do |
|
|
|
|
error_count: Enum.count(unique_numbers) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
handle_unique_key_violation(reason, unique_numbers) |
|
|
|
|
|
|
|
|
|
# re-queue the de-duped entries |
|
|
|
|
{:retry, unique_numbers} |
|
|
|
|
end |
|
|
|
@ -310,6 +312,19 @@ defmodule Indexer.Fetcher.InternalTransaction do |
|
|
|
|
end) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
defp handle_unique_key_violation(%{exception: %{postgres: %{code: :unique_violation}}}, block_numbers) do |
|
|
|
|
BlocksRunner.invalidate_consensus_blocks(block_numbers) |
|
|
|
|
|
|
|
|
|
Logger.error(fn -> |
|
|
|
|
[ |
|
|
|
|
"unique_violation on internal transactions import, block numbers: ", |
|
|
|
|
inspect(block_numbers) |
|
|
|
|
] |
|
|
|
|
end) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
defp handle_unique_key_violation(_reason, _block_numbers), do: :ok |
|
|
|
|
|
|
|
|
|
defp handle_foreign_key_violation(internal_transactions_params, block_numbers) do |
|
|
|
|
BlocksRunner.invalidate_consensus_blocks(block_numbers) |
|
|
|
|
|
|
|
|
|