Delay loading 5minute and hourly tickers to avoid unnecessary calls to Coingecko
This commit is contained in:
parent
8d22752bec
commit
6f170e07b0
@ -419,8 +419,8 @@ func (fr *FiatRates) RunDownloader() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load hourly tickers, give about 30 minutes to prepare the tickers
|
// load hourly tickers, it is necessary to wait about 1 hour to prepare the tickers
|
||||||
if time.Now().UTC().Unix() >= fr.hourlyTickersTo+secondsInHour+secondsInHour/2 {
|
if time.Now().UTC().Unix() >= fr.hourlyTickersTo+secondsInHour+secondsInHour {
|
||||||
hourlyTickers, err := fr.downloader.HourlyTickers()
|
hourlyTickers, err := fr.downloader.HourlyTickers()
|
||||||
if err != nil || hourlyTickers == nil {
|
if err != nil || hourlyTickers == nil {
|
||||||
glog.Error("FiatRatesDownloader: HourlyTickers error ", err)
|
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
|
// load five minute tickers, it is necessary to wait about 10 minutes to prepare the tickers
|
||||||
if time.Now().UTC().Unix() >= fr.fiveMinutesTickersTo+2*secondsInFiveMinutes {
|
if time.Now().UTC().Unix() >= fr.fiveMinutesTickersTo+3*secondsInFiveMinutes {
|
||||||
fiveMinutesTickers, err := fr.downloader.FiveMinutesTickers()
|
fiveMinutesTickers, err := fr.downloader.FiveMinutesTickers()
|
||||||
if err != nil || fiveMinutesTickers == nil {
|
if err != nil || fiveMinutesTickers == nil {
|
||||||
glog.Error("FiatRatesDownloader: FiveMinutesTickers error ", err)
|
glog.Error("FiatRatesDownloader: FiveMinutesTickers error ", err)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user