fix realtime fetcher small skips feature

If indexing is started from scratch, realtime fetcher
tries to index large ranges of blocks. For example, 5..1852044.
It produces errors like
`failed to fetch: :emfile.  Block will be retried by catchup indexer`

This PR limits the number of blocks to 10
pull/2843/head
Ayrat Badykov 5 years ago
parent 814a593baa
commit 187f0dc402
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 2
      apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex
  2. 4
      apps/indexer/lib/indexer/block/realtime/fetcher.ex

@ -308,7 +308,7 @@ defmodule EthereumJSONRPC.Transaction do
end
def to_elixir(transaction) when is_binary(transaction) do
Logger.warn(["Fetched transaction is not full: ", transaction])
# Logger.warn(["Fetched transaction is not full: ", transaction])
nil
end

@ -250,9 +250,13 @@ defmodule Indexer.Block.Realtime.Fetcher do
[number]
true ->
if number - previous_number - 1 > 10 do
(number - 10)..number
else
(previous_number + 1)..number
end
end
end
defp reorg?(number, max_number_seen) when is_integer(max_number_seen) and number <= max_number_seen do
true

Loading…
Cancel
Save