fix: Add no overlapping constraint to missing_block_ranges (#10449)

pull/10244/head
Qwerty5Uiop 4 months ago committed by GitHub
parent 30d01e48ff
commit f1752d972d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      apps/explorer/priv/repo/migrations/20240718150123_add_no_overlap_index_to_missing_block_ranges.exs
  2. 4
      apps/indexer/test/indexer/block/catchup/missing_ranges_collector_test.exs

@ -0,0 +1,11 @@
defmodule Explorer.Repo.Migrations.AddNoOverlapIndexToMissingBlockRanges do
use Ecto.Migration
def change do
create(
constraint(:missing_block_ranges, :missing_block_ranges_no_overlap,
exclude: ~s|gist (int4range(to_number, from_number, '[]') WITH &&)|
)
)
end
end

@ -38,9 +38,9 @@ defmodule Indexer.Block.Catchup.MissingRangesCollectorTest do
Application.put_env(:indexer, :last_block, 200)
insert(:missing_block_range, from_number: 250, to_number: 220)
insert(:missing_block_range, from_number: 220, to_number: 190)
insert(:missing_block_range, from_number: 219, to_number: 190)
insert(:missing_block_range, from_number: 120, to_number: 90)
insert(:missing_block_range, from_number: 90, to_number: 80)
insert(:missing_block_range, from_number: 89, to_number: 80)
MissingRangesCollector.start_link([])
Process.sleep(500)

Loading…
Cancel
Save