Fix MissingRangesManipulator

pull/7493/head
Qwerty5Uiop 2 years ago
parent f6a0adf6fb
commit 20bbb45557
  1. 2
      CHANGELOG.md
  2. 4
      apps/indexer/lib/indexer/block/catchup/fetcher.ex
  3. 13
      apps/indexer/lib/indexer/block/catchup/missing_ranges_manipulator.ex

@ -11,7 +11,7 @@
- [#7355](https://github.com/blockscout/blockscout/pull/7355) - Add endpoint for token info import
- [#7393](https://github.com/blockscout/blockscout/pull/7393) - Realtime fetcher max gap
- [#7436](https://github.com/blockscout/blockscout/pull/7436) - TokenBalanceOnDemand ERC-1155 support
- [#7469](https://github.com/blockscout/blockscout/pull/7469), [#7485](https://github.com/blockscout/blockscout/pull/7485) - Clear missing block ranges after every success import
- [#7469](https://github.com/blockscout/blockscout/pull/7469), [#7485](https://github.com/blockscout/blockscout/pull/7485), [#7493](https://github.com/blockscout/blockscout/pull/7493) - Clear missing block ranges after every success import
- [#7489](https://github.com/blockscout/blockscout/pull/7489) - INDEXER_CATCHUP_BLOCK_INTERVAL env var
### Fixes

@ -75,8 +75,6 @@ defmodule Indexer.Block.Catchup.Fetcher do
shrunk = Shrinkable.shrunk?(sequence)
MissingRangesManipulator.clear_batch(missing_ranges)
%{
first_block_number: first,
last_block_number: last,
@ -275,7 +273,7 @@ defmodule Indexer.Block.Catchup.Fetcher do
success_numbers
|> numbers_to_ranges()
|> Enum.map(&MissingRangesManipulator.delete_range/1)
|> MissingRangesManipulator.clear_batch()
end
defp block_errors_to_block_number_ranges(block_errors) when is_list(block_errors) do

@ -16,12 +16,9 @@ defmodule Indexer.Block.Catchup.MissingRangesManipulator do
GenServer.call(__MODULE__, :get_latest_batch)
end
def delete_range(range) do
GenServer.cast(__MODULE__, {:delete_range, range})
end
@timeout_by_range 2000
def clear_batch(batch) do
GenServer.cast(__MODULE__, {:clear_batch, batch})
GenServer.call(__MODULE__, {:clear_batch, batch}, @timeout_by_range * Enum.count(batch))
end
@impl true
@ -42,9 +39,7 @@ defmodule Indexer.Block.Catchup.MissingRangesManipulator do
{:noreply, state}
end
def handle_cast({:clear_batch, batch}, state) do
MissingBlockRange.clear_batch(batch)
{:noreply, state}
def handle_call({:clear_batch, batch}, _from, state) do
{:reply, MissingBlockRange.clear_batch(batch), state}
end
end

Loading…
Cancel
Save