From 3e690f590e842364fe7f6f4f5db6266b57bf6f3b Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 10 Nov 2020 23:05:44 +0300 Subject: [PATCH] Change default ttl_check_interval for counters on the main page --- CHANGELOG.md | 1 + apps/explorer/lib/explorer/chain/cache/block_count.ex | 8 ++++---- apps/explorer/lib/explorer/chain/cache/gas_usage.ex | 4 ++-- .../lib/explorer/chain/cache/transaction_count.ex | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c9e84af2f..0946b77b0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ - [#3335](https://github.com/poanetwork/blockscout/pull/3335) - MarketCap calculation: check that ETS tables exist before inserting new data or lookup from the table ### Chore +- [#3446](https://github.com/poanetwork/blockscout/pull/3446) - Change default ttl_check_interval for counters on the main page - [#3431](https://github.com/poanetwork/blockscout/pull/3431) - Standardize token name definition, if name is empty - [#3421](https://github.com/poanetwork/blockscout/pull/3421) - Functions to enable GnosisSafe app link - [#3414](https://github.com/poanetwork/blockscout/pull/3414) - Manage lis of other explorers in the footer via env var diff --git a/apps/explorer/lib/explorer/chain/cache/block_count.ex b/apps/explorer/lib/explorer/chain/cache/block_count.ex index ef1e587dfe..b8fae34587 100644 --- a/apps/explorer/lib/explorer/chain/cache/block_count.ex +++ b/apps/explorer/lib/explorer/chain/cache/block_count.ex @@ -3,18 +3,18 @@ defmodule Explorer.Chain.Cache.BlockCount do Cache for block count. """ - require Logger - - @default_cache_period :timer.minutes(10) + @default_cache_period :timer.hours(2) use Explorer.Chain.MapCache, name: :block_count, key: :count, key: :async_task, global_ttl: cache_period(), - ttl_check_interval: :timer.minutes(1), + ttl_check_interval: :timer.minutes(15), callback: &async_task_on_deletion(&1) + require Logger + alias Explorer.Chain defp handle_fallback(:count) do diff --git a/apps/explorer/lib/explorer/chain/cache/gas_usage.ex b/apps/explorer/lib/explorer/chain/cache/gas_usage.ex index 76112f6812..132f414683 100644 --- a/apps/explorer/lib/explorer/chain/cache/gas_usage.ex +++ b/apps/explorer/lib/explorer/chain/cache/gas_usage.ex @@ -5,14 +5,14 @@ defmodule Explorer.Chain.Cache.GasUsage do require Logger - @default_cache_period :timer.minutes(30) + @default_cache_period :timer.hours(2) use Explorer.Chain.MapCache, name: :gas_usage, key: :sum, key: :async_task, global_ttl: cache_period(), - ttl_check_interval: :timer.minutes(1), + ttl_check_interval: :timer.minutes(15), callback: &async_task_on_deletion(&1) alias Explorer.Chain diff --git a/apps/explorer/lib/explorer/chain/cache/transaction_count.ex b/apps/explorer/lib/explorer/chain/cache/transaction_count.ex index d6b2f7ae0d..e850310bca 100644 --- a/apps/explorer/lib/explorer/chain/cache/transaction_count.ex +++ b/apps/explorer/lib/explorer/chain/cache/transaction_count.ex @@ -10,7 +10,7 @@ defmodule Explorer.Chain.Cache.TransactionCount do key: :count, key: :async_task, global_ttl: cache_period(), - ttl_check_interval: :timer.minutes(10), + ttl_check_interval: :timer.minutes(15), callback: &async_task_on_deletion(&1) require Logger