From 187f0dc4025c189f32459a64572fa3eec1c40e84 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 7 Nov 2019 12:11:01 +0300 Subject: [PATCH] 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 --- apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex | 2 +- apps/indexer/lib/indexer/block/realtime/fetcher.ex | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex index 7992c0e63c..031b150384 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/transaction.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 diff --git a/apps/indexer/lib/indexer/block/realtime/fetcher.ex b/apps/indexer/lib/indexer/block/realtime/fetcher.ex index 37958905b9..5767270f87 100644 --- a/apps/indexer/lib/indexer/block/realtime/fetcher.ex +++ b/apps/indexer/lib/indexer/block/realtime/fetcher.ex @@ -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