From 1068c5f775af8436661141447d7634fdc3d976d1 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Wed, 30 Jan 2019 11:35:57 +0300 Subject: [PATCH] start cache in repo process --- apps/explorer/lib/explorer/application.ex | 7 +++++-- apps/explorer/lib/explorer/chain/block_number_cache.ex | 4 ++++ .../test/explorer/chain/block_number_cache_test.exs | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/explorer/lib/explorer/application.ex b/apps/explorer/lib/explorer/application.ex index c719c500bc..ecf4250213 100644 --- a/apps/explorer/lib/explorer/application.ex +++ b/apps/explorer/lib/explorer/application.ex @@ -12,7 +12,6 @@ defmodule Explorer.Application do @impl Application def start(_type, _args) do PrometheusLogger.setup() - BlockNumberCache.setup() :telemetry.attach( "prometheus-ecto", @@ -35,7 +34,11 @@ defmodule Explorer.Application do opts = [strategy: :one_for_one, name: Explorer.Supervisor] - Supervisor.start_link(children, opts) + res = Supervisor.start_link(children, opts) + + BlockNumberCache.setup() + + res end defp configurable_children do diff --git a/apps/explorer/lib/explorer/chain/block_number_cache.ex b/apps/explorer/lib/explorer/chain/block_number_cache.ex index e1d8d6dea5..1ac25f34fc 100644 --- a/apps/explorer/lib/explorer/chain/block_number_cache.ex +++ b/apps/explorer/lib/explorer/chain/block_number_cache.ex @@ -1,4 +1,8 @@ defmodule Explorer.Chain.BlockNumberCache do + @moduledoc """ + Cache for max and min block numbers. + """ + alias Explorer.Chain @tab :block_number_cache diff --git a/apps/explorer/test/explorer/chain/block_number_cache_test.exs b/apps/explorer/test/explorer/chain/block_number_cache_test.exs index 95b4314707..a33263293c 100644 --- a/apps/explorer/test/explorer/chain/block_number_cache_test.exs +++ b/apps/explorer/test/explorer/chain/block_number_cache_test.exs @@ -1,4 +1,4 @@ -defmodule Explorer.ChainTest do +defmodule Explorer.Chain.BlockNumberCacheTest do use Explorer.DataCase alias Explorer.Chain.BlockNumberCache