From ecde63be6c362a9e15b5a563869ca373f44a91f2 Mon Sep 17 00:00:00 2001 From: Maxim Filonov <53992153+sl1depengwyn@users.noreply.github.com> Date: Wed, 24 Jan 2024 20:19:22 +0300 Subject: [PATCH] Add `MARKET_HISTORY_FETCH_INTERVAL` env (#9197) --- CHANGELOG.md | 1 + apps/explorer/lib/explorer/market/history/cataloger.ex | 7 +++---- config/runtime.exs | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d3dd5a34d..56c6a4a8b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ ### Chore - [#9198](https://github.com/blockscout/blockscout/pull/9198) - Make Postgres@15 default option +- [#9197](https://github.com/blockscout/blockscout/pull/9197) - Add `MARKET_HISTORY_FETCH_INTERVAL` env - [#9196](https://github.com/blockscout/blockscout/pull/9196) - Compatibility with docker-compose 2.24 - [#9193](https://github.com/blockscout/blockscout/pull/9193) - Equalize elixir stack versions diff --git a/apps/explorer/lib/explorer/market/history/cataloger.ex b/apps/explorer/lib/explorer/market/history/cataloger.ex index f3c73de23d..ad53c64ff7 100644 --- a/apps/explorer/lib/explorer/market/history/cataloger.ex +++ b/apps/explorer/lib/explorer/market/history/cataloger.ex @@ -4,10 +4,9 @@ defmodule Explorer.Market.History.Cataloger do Market grabs the last 365 day's worth of market history for the configured coin in the explorer. Once that data is fetched, current day's values are - checked every 60 minutes. Additionally, failed requests to the history - source will follow exponential backoff `100ms * 2^(n+1)` where `n` is the - number of failed requests. - + checked every `MARKET_HISTORY_FETCH_INTERVAL` or every 60 minutes by default. + Additionally, failed requests to the history source will follow exponential + backoff `100ms * 2^(n+1)` where `n` is the number of failed requests. """ use GenServer diff --git a/config/runtime.exs b/config/runtime.exs index f6494acbeb..960c6bf4dc 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -312,7 +312,9 @@ config :explorer, Explorer.ExchangeRates.TokenExchangeRates, refetch_interval: ConfigHelper.parse_time_env_var("TOKEN_EXCHANGE_RATE_REFETCH_INTERVAL", "1h"), max_batch_size: ConfigHelper.parse_integer_env_var("TOKEN_EXCHANGE_RATE_MAX_BATCH_SIZE", 150) -config :explorer, Explorer.Market.History.Cataloger, enabled: !disable_indexer? && !disable_exchange_rates? +config :explorer, Explorer.Market.History.Cataloger, + enabled: !disable_indexer? && !disable_exchange_rates?, + history_fetch_interval: ConfigHelper.parse_time_env_var("MARKET_HISTORY_FETCH_INTERVAL", "1h") config :explorer, Explorer.Chain.Transaction, suave_bid_contracts: System.get_env("SUAVE_BID_CONTRACTS", "")