From b4fe4c90857be24dc5ccc5b8b9f58ff5502da9ed Mon Sep 17 00:00:00 2001 From: Sean Hagstrom Date: Fri, 13 Sep 2024 12:20:33 +0100 Subject: [PATCH] fix_: fallback to cache for token prices when calling GetWalletToken --- services/wallet/reader.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/wallet/reader.go b/services/wallet/reader.go index 06a2719b3..d07719556 100644 --- a/services/wallet/reader.go +++ b/services/wallet/reader.go @@ -479,15 +479,15 @@ func (r *Reader) GetWalletToken(ctx context.Context, clients map[uint64]chain.Cl var ( group = async.NewAtomicGroup(ctx) - prices = map[string]map[string]float64{} + prices = map[string]map[string]market.DataPoint{} tokenDetails = map[string]thirdparty.TokenDetails{} tokenMarketValues = map[string]thirdparty.TokenMarketValues{} ) group.Add(func(parent context.Context) error { - prices, err = r.marketManager.FetchPrices(tokenSymbols, currencies) + prices, err = r.marketManager.GetOrFetchPrices(tokenSymbols, currencies, 60) if err != nil { - log.Info("marketManager.FetchPrices err", err) + log.Info("marketManager.GetOrFetchPrices err", err) } return nil }) @@ -533,7 +533,7 @@ func (r *Reader) GetWalletToken(ctx context.Context, clients map[uint64]chain.Cl ChangePctDay: tokenMarketValues[tok.Symbol].CHANGEPCTDAY, ChangePct24hour: tokenMarketValues[tok.Symbol].CHANGEPCT24HOUR, Change24hour: tokenMarketValues[tok.Symbol].CHANGE24HOUR, - Price: prices[tok.Symbol][currency], + Price: prices[tok.Symbol][currency].Price, HasError: !r.marketManager.IsConnected, } }