check if ets table exist

pull/1388/head
Ayrat Badykov 6 years ago
parent 1068c5f775
commit 12f1b200b3
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 16
      apps/explorer/lib/explorer/chain/block_number_cache.ex

@ -13,15 +13,17 @@ defmodule Explorer.Chain.BlockNumberCache do
@spec setup(Keyword.t()) :: :ok
def setup(opts \\ []) do
:ets.new(@tab, [
:set,
:named_table,
:public,
write_concurrency: true
])
if :ets.whereis(@tab) == :undefined do
:ets.new(@tab, [
:set,
:named_table,
:public,
write_concurrency: true
])
end
update_cache()
setup_opts(opts)
update_cache()
:ok
end

Loading…
Cancel
Save