|
|
|
@ -37,7 +37,7 @@ defmodule Indexer.Block.Realtime.Fetcher do |
|
|
|
|
|
|
|
|
|
@behaviour Block.Fetcher |
|
|
|
|
|
|
|
|
|
@minimum_safe_polling_period :timer.seconds(10) |
|
|
|
|
@minimum_safe_polling_period :timer.seconds(5) |
|
|
|
|
|
|
|
|
|
@enforce_keys ~w(block_fetcher)a |
|
|
|
|
defstruct ~w(block_fetcher subscription previous_number max_number_seen timer)a |
|
|
|
@ -157,7 +157,7 @@ defmodule Indexer.Block.Realtime.Fetcher do |
|
|
|
|
polling_period = |
|
|
|
|
case AverageBlockTime.average_block_time() do |
|
|
|
|
{:error, :disabled} -> 2_000 |
|
|
|
|
block_time -> round(Duration.to_milliseconds(block_time) * 2) |
|
|
|
|
block_time -> round(Duration.to_milliseconds(block_time) / 2) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
safe_polling_period = max(polling_period, @minimum_safe_polling_period) |
|
|
|
|