COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES

pull/5240/head
Viktor Baranov 3 years ago
parent b9ce8757b7
commit 5920820047
  1. 1
      CHANGELOG.md
  2. 12
      apps/indexer/config/config.exs
  3. 4
      apps/indexer/lib/indexer/fetcher/coin_balance_on_demand.ex
  4. 6
      docker/Makefile

@ -540,6 +540,7 @@
- [#3335](https://github.com/blockscout/blockscout/pull/3335) - MarketCap calculation: check that ETS tables exist before inserting new data or lookup from the table
### Chore
- [#5240](https://github.com/blockscout/blockscout/pull/5240) - Managing invalidation of address coin balance cache
- [#3450](https://github.com/blockscout/blockscout/pull/3450) - Replace window.web3 with window.ethereum
- [#3446](https://github.com/blockscout/blockscout/pull/3446), [#3448](https://github.com/blockscout/blockscout/pull/3448) - Set infinity timeout and increase cache invalidation period for counters
- [#3431](https://github.com/blockscout/blockscout/pull/3431) - Standardize token name definition, if name is empty

@ -57,6 +57,18 @@ token_balance_on_demand_fetcher_threshold =
config :indexer, Indexer.Fetcher.TokenBalanceOnDemand, threshold: token_balance_on_demand_fetcher_threshold
coin_balance_on_demand_fetcher_threshold =
if System.get_env("COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES") do
case Integer.parse(System.get_env("COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES")) do
{integer, ""} -> integer
_ -> 60
end
else
60
end
config :indexer, Indexer.Fetcher.CoinBalanceOnDemand, threshold: coin_balance_on_demand_fetcher_threshold
# config :indexer, Indexer.Fetcher.ReplacedTransaction.Supervisor, disabled?: true
if System.get_env("POS_STAKING_CONTRACT") do
config :indexer, Indexer.Fetcher.BlockReward.Supervisor, disabled?: true

@ -7,8 +7,6 @@ defmodule Indexer.Fetcher.CoinBalanceOnDemand do
If we have a fetched coin balance, but it is over 100 blocks old, we will fetch and create a fetched coin baalnce.
"""
@latest_balance_stale_threshold :timer.hours(24)
use GenServer
use Indexer.Fetcher
@ -232,7 +230,7 @@ defmodule Indexer.Fetcher.CoinBalanceOnDemand do
if average_block_time == 0 do
{:error, :empty_database}
else
block_number - div(@latest_balance_stale_threshold, average_block_time)
block_number - div(:timer.minutes(Application.get_env(:indexer, __MODULE__)[:threshold]), average_block_time)
end
end
end

@ -385,6 +385,12 @@ endif
ifdef INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER
BLOCKSCOUT_CONTAINER_PARAMS += -e 'INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER=$(INDEXER_DISABLE_INTERNAL_TRANSACTIONS_FETCHER)'
endif
ifdef TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES=$(TOKEN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES)'
endif
ifdef COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES
BLOCKSCOUT_CONTAINER_PARAMS += -e 'COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES=$(COIN_BALANCE_ON_DEMAND_FETCHER_THRESHOLD_MINUTES)'
endif
HAS_BLOCKSCOUT_IMAGE := $(shell docker images | grep -sw "${BS_CONTAINER_IMAGE} ")
build:

Loading…
Cancel
Save