mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-04-27 17:17:57 +00:00
fix: prevent staking dashboard infinite loading
- Add maxAttempts parameter to retryUntilDone (default unlimited for backward compat), use 5 retries for staking stats fetch - Catch fetchStakingStats failure in dashboard update system and fallback to empty stats instead of hanging forever - Restore stale scope detection in ComputationalCache so cancelled aggregate scopes are recreated instead of returning stale entries
This commit is contained in:
+1
-1
@@ -39,7 +39,7 @@ class RealStakingStatsDataSource(
|
||||
stakingAccounts: StakingAccounts,
|
||||
stakingChains: List<Chain>
|
||||
): MultiChainStakingStats = withContext(Dispatchers.IO) {
|
||||
retryUntilDone {
|
||||
retryUntilDone(maxAttempts = 5) {
|
||||
val globalConfig = globalConfigDataSource.getGlobalConfig()
|
||||
val chainsByEndpoint = splitChainsByEndpoint(stakingChains, globalConfig)
|
||||
|
||||
|
||||
+8
-1
@@ -127,9 +127,16 @@ class RealStakingDashboardUpdateSystem(
|
||||
.onEach { latestOffChainSyncIndex.value = it.index }
|
||||
.throttleLast(offChainSyncDebounceRate)
|
||||
.mapLatest { (index, stakingAccounts) ->
|
||||
val stats = runCatching {
|
||||
stakingStatsDataSource.fetchStakingStats(stakingAccounts, stakingChains)
|
||||
}.getOrElse {
|
||||
Log.d("StakingDashboardUpdateSystem", "Failed to fetch staking stats after retries", it)
|
||||
emptyMap()
|
||||
}
|
||||
|
||||
MultiChainOffChainSyncResult(
|
||||
index = index,
|
||||
multiChainStakingStats = stakingStatsDataSource.fetchStakingStats(stakingAccounts, stakingChains),
|
||||
multiChainStakingStats = stats,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user