mirror of
https://github.com/status-im/status-go.git
synced 2025-02-16 16:56:53 +00:00
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 (
|
var (
|
||||||
group = async.NewAtomicGroup(ctx)
|
group = async.NewAtomicGroup(ctx)
|
||||||
prices = map[string]map[string]float64{}
|
prices = map[string]map[string]market.DataPoint{}
|
||||||
tokenDetails = map[string]thirdparty.TokenDetails{}
|
tokenDetails = map[string]thirdparty.TokenDetails{}
|
||||||
tokenMarketValues = map[string]thirdparty.TokenMarketValues{}
|
tokenMarketValues = map[string]thirdparty.TokenMarketValues{}
|
||||||
)
|
)
|
||||||
|
|
||||||
group.Add(func(parent context.Context) error {
|
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 {
|
if err != nil {
|
||||||
log.Info("marketManager.FetchPrices err", err)
|
log.Info("marketManager.GetOrFetchPrices err", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
@ -533,7 +533,7 @@ func (r *Reader) GetWalletToken(ctx context.Context, clients map[uint64]chain.Cl
|
|||||||
ChangePctDay: tokenMarketValues[tok.Symbol].CHANGEPCTDAY,
|
ChangePctDay: tokenMarketValues[tok.Symbol].CHANGEPCTDAY,
|
||||||
ChangePct24hour: tokenMarketValues[tok.Symbol].CHANGEPCT24HOUR,
|
ChangePct24hour: tokenMarketValues[tok.Symbol].CHANGEPCT24HOUR,
|
||||||
Change24hour: tokenMarketValues[tok.Symbol].CHANGE24HOUR,
|
Change24hour: tokenMarketValues[tok.Symbol].CHANGE24HOUR,
|
||||||
Price: prices[tok.Symbol][currency],
|
Price: prices[tok.Symbol][currency].Price,
|
||||||
HasError: !r.marketManager.IsConnected,
|
HasError: !r.marketManager.IsConnected,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user