fix_: fallback to cache for token prices when calling GetWalletToken
This commit is contained in:
parent
5cc39ac272
commit
b4fe4c9085
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue