Skip to content

Commit dc113fd

Browse files
committed
chore: update tags async
1 parent 25a64d4 commit dc113fd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/src/main/java/to/bitkit/repositories/ActivityRepo.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ import com.synonym.bitkitcore.ActivityFilter
66
import com.synonym.bitkitcore.PaymentType
77
import com.synonym.bitkitcore.SortDirection
88
import kotlinx.coroutines.CoroutineDispatcher
9+
import kotlinx.coroutines.CoroutineScope
10+
import kotlinx.coroutines.SupervisorJob
911
import kotlinx.coroutines.TimeoutCancellationException
1012
import kotlinx.coroutines.flow.MutableStateFlow
1113
import kotlinx.coroutines.flow.first
1214
import kotlinx.coroutines.flow.map
15+
import kotlinx.coroutines.launch
1316
import kotlinx.coroutines.withContext
1417
import kotlinx.coroutines.withTimeout
1518
import org.lightningdevkit.ldknode.PaymentDetails
@@ -44,6 +47,7 @@ class ActivityRepo @Inject constructor(
4447
private val addressChecker: AddressChecker,
4548
) {
4649
val isSyncingLdkNodePayments = MutableStateFlow(false)
50+
private val scope = CoroutineScope(bgDispatcher + SupervisorJob())
4751

4852
val inProgressTransfers = cacheStore.data.map { it.inProgressTransfers }
4953

@@ -65,10 +69,12 @@ class ActivityRepo @Inject constructor(
6569
val syncResult = syncLdkNodePayments(payments = payments).onFailure { e ->
6670
return@withContext Result.failure(e)
6771
}
72+
scope.launch {
73+
syncResult.getOrNull()?.let { syncTagsMetaData(it) }
74+
}
6875
updateActivitiesMetadata()
6976
boostPendingActivities()
7077
updateInProgressTransfers()
71-
syncResult.getOrNull()?.let { syncTagsMetaData(it) }
7278
isSyncingLdkNodePayments.value = false
7379
return@withContext Result.success(Unit)
7480
}.onFailure { e ->

0 commit comments

Comments
 (0)