Fetch balances when db cache doesn't exist (second attempt) (#4714)
This commit is contained in:
parent
8d4f4904c6
commit
af16669787
|
@ -275,8 +275,17 @@ func (r *Reader) FetchOrGetCachedWalletBalances(ctx context.Context, addresses [
|
||||||
}
|
}
|
||||||
|
|
||||||
tokens, err := r.persistence.GetTokens()
|
tokens, err := r.persistence.GetTokens()
|
||||||
|
|
||||||
|
addressWithoutCachedBalances := false
|
||||||
|
for _, address := range addresses {
|
||||||
|
if _, ok := tokens[address]; !ok {
|
||||||
|
addressWithoutCachedBalances = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// there should be at least ETH balance
|
// there should be at least ETH balance
|
||||||
if len(tokens) == 0 {
|
if addressWithoutCachedBalances {
|
||||||
return r.GetWalletTokenBalances(ctx, addresses)
|
return r.GetWalletTokenBalances(ctx, addresses)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue