Updated on 2026-08-14
This commit is contained in:
parent
4f3ff79ac9
commit
158fd355de
9 changed files with 40 additions and 200 deletions
|
|
@ -35,6 +35,10 @@ class CryptoCurrencyBalanceFetcher(
|
|||
|
||||
private val mutex = Mutex()
|
||||
|
||||
operator fun invoke(userWalletId: UserWalletId, currency: CryptoCurrency) {
|
||||
invoke(userWalletId = userWalletId, currencies = listOf(currency))
|
||||
}
|
||||
|
||||
operator fun invoke(userWalletId: UserWalletId, currencies: List<CryptoCurrency>) {
|
||||
if (currencies.isEmpty()) return
|
||||
|
||||
|
|
@ -45,6 +49,18 @@ class CryptoCurrencyBalanceFetcher(
|
|||
}
|
||||
}
|
||||
|
||||
suspend fun invokeAndAwait(userWalletId: UserWalletId, currency: CryptoCurrency) {
|
||||
invokeAndAwait(userWalletId = userWalletId, currencies = listOf(currency))
|
||||
}
|
||||
|
||||
suspend fun invokeAndAwait(userWalletId: UserWalletId, currencies: List<CryptoCurrency>) {
|
||||
if (currencies.isEmpty()) return
|
||||
|
||||
mutex.withLock {
|
||||
refreshBalances(userWalletId, currencies)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun refreshBalances(userWalletId: UserWalletId, currencies: List<CryptoCurrency>) {
|
||||
coroutineScope {
|
||||
val results = listOf(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue