Skip to content

Commit

Permalink
fix realtime fetcher small skips feature
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ayrat555 committed Nov 7, 2019
1 parent 814a593 commit 187f0dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion apps/indexer/lib/indexer/block/realtime/fetcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ defmodule Indexer.Block.Realtime.Fetcher do
[number]

true ->
(previous_number + 1)..number
if number - previous_number - 1 > 10 do
(number - 10)..number
else
(previous_number + 1)..number
end
end
end

Expand Down

0 comments on commit 187f0dc

Please sign in to comment.