Skip to content

Commit 7a1c216

Browse files
committed
chore(flipcash): reduce pool calls on app open
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent ebddee7 commit 7a1c216

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

apps/flipcash/shared/pools/src/main/kotlin/com/flipcash/app/pools/PoolUpdater.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.flipcash.app.pools
22

3-
import com.flipcash.app.core.cache.CachePolicy
43
import com.flipcash.app.core.updater.NetworkUpdater
54
import com.getcode.opencode.model.core.ID
65
import com.getcode.utils.base58

apps/flipcash/shared/pools/src/main/kotlin/com/flipcash/app/pools/PoolsCoordinator.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ class PoolsCoordinator @Inject constructor(
5959
private val networkToDomainMapper: NetworkPoolToDomainMapper,
6060
private val userManager: UserManager,
6161
) {
62-
val supervisor = CoroutineScope(Dispatchers.IO + SupervisorJob())
63-
6462
private val pagingConfig = PagingConfig(pageSize = 20)
6563

6664
private val _poolOpen = MutableStateFlow<ID?>(null)
@@ -143,7 +141,11 @@ class PoolsCoordinator @Inject constructor(
143141
}
144142

145143
suspend fun updatePool(id: ID) {
146-
getPool(id, CachePolicy.NetworkOnly)
144+
val pool = dataSource.getById(id)
145+
val hasDecision = pool?.pool?.resolution is PoolResolution.DecisionMade
146+
if (!hasDecision) {
147+
getPool(id, CachePolicy.NetworkOnly)
148+
}
147149
}
148150

149151
suspend fun getPool(rendezvous: KeyPair): Result<PoolWithBets> {

apps/flipcash/shared/session/src/main/kotlin/com/flipcash/app/session/internal/RealSessionController.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,6 @@ class RealSessionController @Inject constructor(
338338
scope.launch {
339339
poolsCoordinator.updatePools()
340340
}
341-
scope.launch {
342-
poolsCoordinator.fetchSinceLatest(count)
343-
}
344341
}
345342
}
346343

0 commit comments

Comments
 (0)