@@ -6,10 +6,13 @@ import com.synonym.bitkitcore.ActivityFilter
66import com.synonym.bitkitcore.PaymentType
77import com.synonym.bitkitcore.SortDirection
88import kotlinx.coroutines.CoroutineDispatcher
9+ import kotlinx.coroutines.CoroutineScope
10+ import kotlinx.coroutines.SupervisorJob
911import kotlinx.coroutines.TimeoutCancellationException
1012import kotlinx.coroutines.flow.MutableStateFlow
1113import kotlinx.coroutines.flow.first
1214import kotlinx.coroutines.flow.map
15+ import kotlinx.coroutines.launch
1316import kotlinx.coroutines.withContext
1417import kotlinx.coroutines.withTimeout
1518import 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