rescue failing repo in block number cache update

pull/1711/head
Ayrat Badykov 6 years ago
parent 42f8e72e80
commit 08c4266d63
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 9
      apps/explorer/lib/explorer/chain/block_number_cache.ex

@ -61,7 +61,7 @@ defmodule Explorer.Chain.BlockNumberCache do
defp update_cache do
current_time = current_time()
{min, max} = Chain.fetch_min_and_max_block_numbers()
{min, max} = min_and_max_from_db()
tuple = {min, max, current_time}
:ets.insert(@tab, {@key, tuple})
@ -85,6 +85,13 @@ defmodule Explorer.Chain.BlockNumberCache do
cache_period
end
defp min_and_max_from_db do
Chain.fetch_min_and_max_block_numbers()
rescue
_e ->
{0, 0}
end
defp current_time do
utc_now = DateTime.utc_now()

Loading…
Cancel
Save