Add head offset for empty blocks sanitizer

remove-block-consensus-on-import-fail
Qwerty5Uiop 1 year ago
parent bc10429611
commit 0173d3d7f1
  1. 8
      apps/indexer/lib/indexer/fetcher/empty_blocks_sanitizer.ex
  2. 2
      config/runtime.exs

@ -15,6 +15,7 @@ defmodule Indexer.Fetcher.EmptyBlocksSanitizer do
alias Ecto.Changeset
alias Explorer.{Chain, Repo}
alias Explorer.Chain.{Block, PendingBlockOperation, Transaction}
alias Explorer.Chain.Cache.BlockNumber
alias Explorer.Chain.Import.Runner.Blocks
@interval :timer.seconds(10)
@ -133,13 +134,16 @@ defmodule Indexer.Fetcher.EmptyBlocksSanitizer do
{:error, %{exception: postgrex_error}}
end
@head_offset 1000
defp consensus_blocks_with_nil_is_empty_query(limit) do
safe_block_number = BlockNumber.get_max() - @head_offset
from(block in Block,
where: is_nil(block.is_empty),
where: block.number <= ^safe_block_number,
where: block.consensus == true,
order_by: [asc: block.hash],
limit: ^limit,
offset: 1000
limit: ^limit
)
end

@ -525,7 +525,7 @@ config :indexer, Indexer.Fetcher.TokenInstance.LegacySanitize.Supervisor,
config :indexer, Indexer.Fetcher.EmptyBlocksSanitizer,
batch_size: ConfigHelper.parse_integer_env_var("INDEXER_EMPTY_BLOCKS_SANITIZER_BATCH_SIZE", 100),
interval: ConfigHelper.parse_time_env_var("INDEXER_EMPTY_BLOCKS_SANITIZER_INTERVAL", "5m")
interval: ConfigHelper.parse_time_env_var("INDEXER_EMPTY_BLOCKS_SANITIZER_INTERVAL", "10s")
config :indexer, Indexer.Block.Realtime.Fetcher,
max_gap: ConfigHelper.parse_integer_env_var("INDEXER_REALTIME_FETCHER_MAX_GAP", 1000)

Loading…
Cancel
Save