fix: Avoid key violation error in `Indexer.Fetcher.Optimism.TxnBatch` (#10752)

* fix: Remove key violation error from Indexer.Fetcher.Optimism.TxnBatch fetcher

* Update cspell.json

---------

Co-authored-by: POA <33550681+poa@users.noreply.github.com>
pull/10756/head
varasev 2 months ago committed by GitHub
parent b55cc8efb1
commit 85ecef9e30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      apps/indexer/lib/indexer/fetcher/optimism/txn_batch.ex
  2. 1
      cspell.json

@ -1265,7 +1265,15 @@ defmodule Indexer.Fetcher.Optimism.TxnBatch do
|> Enum.uniq()
|> Enum.filter(fn id -> id > 0 end)
Repo.delete_all(from(fs in FrameSequence, where: fs.id in ^ids))
try do
Repo.delete_all(from(fs in FrameSequence, where: fs.id in ^ids))
rescue
# we need to ignore `foreign_key_violation` exception when deleting the rows
# because there can be a case when the chain partially replaces the frame sequence
# (e.g. Unichain Private Testnet), and so some rows in `op_transaction_batches` table
# can still reference to the `op_frame_sequences` table
_ -> nil
end
end
defp set_frame_sequences_view_ready(sequences) do

@ -564,6 +564,7 @@
"unfetched",
"unfinalized",
"unindexed",
"Unichain",
"Unitarion",
"Unitorius",
"Unitorus",

Loading…
Cancel
Save