From 6f170e07b0cb8ee22f78f72422beeff492163dd7 Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Fri, 7 Jun 2024 16:54:58 +0200 Subject: [PATCH] Delay loading 5minute and hourly tickers to avoid unnecessary calls to Coingecko --- fiat/fiat_rates.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fiat/fiat_rates.go b/fiat/fiat_rates.go index a9a37979..13e7168f 100644 --- a/fiat/fiat_rates.go +++ b/fiat/fiat_rates.go @@ -419,8 +419,8 @@ func (fr *FiatRates) RunDownloader() error { } } - // load hourly tickers, give about 30 minutes to prepare the tickers - if time.Now().UTC().Unix() >= fr.hourlyTickersTo+secondsInHour+secondsInHour/2 { + // load hourly tickers, it is necessary to wait about 1 hour to prepare the tickers + if time.Now().UTC().Unix() >= fr.hourlyTickersTo+secondsInHour+secondsInHour { hourlyTickers, err := fr.downloader.HourlyTickers() if err != nil || hourlyTickers == nil { glog.Error("FiatRatesDownloader: HourlyTickers error ", err) @@ -430,8 +430,8 @@ func (fr *FiatRates) RunDownloader() error { } } - // load five minute tickers, give about 5 minutes to prepare the tickers - if time.Now().UTC().Unix() >= fr.fiveMinutesTickersTo+2*secondsInFiveMinutes { + // load five minute tickers, it is necessary to wait about 10 minutes to prepare the tickers + if time.Now().UTC().Unix() >= fr.fiveMinutesTickersTo+3*secondsInFiveMinutes { fiveMinutesTickers, err := fr.downloader.FiveMinutesTickers() if err != nil || fiveMinutesTickers == nil { glog.Error("FiatRatesDownloader: FiveMinutesTickers error ", err)