Handle internal transactions unique_violation

pull/7855/head
Qwerty5Uiop 1 year ago
parent 804419076d
commit 187b4235d6
  1. 1
      CHANGELOG.md
  2. 15
      apps/indexer/lib/indexer/fetcher/internal_transaction.ex

@ -15,6 +15,7 @@
- [#7758](https://github.com/blockscout/blockscout/pull/7758) - Remove limit for configurable fetchers
- [#7764](https://github.com/blockscout/blockscout/pull/7764) - Fix missing ranges insertion and deletion logic
- [#7843](https://github.com/blockscout/blockscout/pull/7843) - Fix created_contract_code_indexed_at updating
- [#7855](https://github.com/blockscout/blockscout/pull/7855) - Handle internal transactions unique_violation
### Chore

@ -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)

Loading…
Cancel
Save