Updated on 2026-08-14
This commit is contained in:
parent
c795074253
commit
e7da35375b
1 changed files with 3 additions and 21 deletions
|
|
@ -53,7 +53,7 @@ internal class DefaultNetworksRepository(
|
|||
|
||||
override suspend fun fetchNetworkPendingTransactions(userWalletId: UserWalletId, networks: Set<Network>) {
|
||||
withContext(dispatchers.io) {
|
||||
fetchNetworksPendingTransactionsIfCacheExpired(userWalletId, networks, false)
|
||||
fetchNetworksPendingTransactions(userWalletId, networks)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,16 +82,12 @@ internal class DefaultNetworksRepository(
|
|||
}
|
||||
}
|
||||
|
||||
private suspend fun fetchNetworksPendingTransactionsIfCacheExpired(
|
||||
userWalletId: UserWalletId,
|
||||
networks: Set<Network>,
|
||||
refresh: Boolean,
|
||||
) {
|
||||
private suspend fun fetchNetworksPendingTransactions(userWalletId: UserWalletId, networks: Set<Network>) {
|
||||
coroutineScope {
|
||||
networks
|
||||
.map { network ->
|
||||
async {
|
||||
fetchNetworkPendingTransactionsIfCacheExpired(userWalletId, network, refresh)
|
||||
fetchNetworkPendingTransactions(userWalletId, network)
|
||||
}
|
||||
}
|
||||
.awaitAll()
|
||||
|
|
@ -110,20 +106,6 @@ internal class DefaultNetworksRepository(
|
|||
)
|
||||
}
|
||||
|
||||
private suspend fun fetchNetworkPendingTransactionsIfCacheExpired(
|
||||
userWalletId: UserWalletId,
|
||||
network: Network,
|
||||
refresh: Boolean,
|
||||
) {
|
||||
val key = getNetworksStatusesCacheKey(userWalletId, network)
|
||||
cacheRegistry.invalidate(key)
|
||||
cacheRegistry.invokeOnExpire(
|
||||
key = key,
|
||||
skipCache = refresh,
|
||||
block = { fetchNetworkPendingTransactions(userWalletId, network) },
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun fetchNetworkStatus(userWalletId: UserWalletId, network: Network) {
|
||||
val currencies = getCurrencies(userWalletId, network)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue