Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ data class ListDiff<T>(
fun <T> Flow<Collection<T>>.diffed(): Flow<ListDiff<T>> {
return zipWithPrevious().map { (previous, new) ->
val addedOrModified = new - previous.orEmpty().toSet()
val removed = if (previous != null && previous.size != new.size) previous - new.toSet() else emptyList()
val removed = previous?.let { it - new.toSet() } ?: emptyList()

ListDiff(removed = removed, addedOrModified = addedOrModified, all = new.toList())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ fun cryptoDetailAbbreviatedFormatter() = CompoundNumberFormatter(
NumberAbbreviation(BigDecimal.ZERO, BigDecimal.ONE, "", cryptoAmountDetailFormatter),
NumberAbbreviation(BigDecimal.ONE, BigDecimal.ONE, "", cryptoAmountDetailFormatter),
NumberAbbreviation(BigDecimal("1E+3"), BigDecimal.ONE, "", cryptoAmountShortFormatter),
NumberAbbreviation(BigDecimal("1E+6"), BigDecimal("1E+6"), "M", cryptoAmountShortFormatter),
NumberAbbreviation(BigDecimal("1E+9"), BigDecimal("1E+9"), "B", cryptoAmountShortFormatter),
NumberAbbreviation(BigDecimal("1E+12"), BigDecimal("1E+12"), "T", cryptoAmountShortFormatter),
NumberAbbreviation(BigDecimal("1E+6"), BigDecimal("1E+6"), "M", cryptoAmountDetailFormatter),
NumberAbbreviation(BigDecimal("1E+9"), BigDecimal("1E+9"), "B", cryptoAmountDetailFormatter),
NumberAbbreviation(BigDecimal("1E+12"), BigDecimal("1E+12"), "T", cryptoAmountDetailFormatter),
NumberAbbreviation(BigDecimal("1E+15"), BigDecimal("1E+12"), "T", cryptoAmountShortFormatter)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ class ChainRegistry @Inject constructor(
fun syncUp() {
chainsToSync.onEach { (removed, addedOrModified, all) ->
coroutineScope {
val removedDeferred = removed.map {
val addedIds = addedOrModified.map(Chain::id).toSet()
val removedTrue = removed.filterNot { it.id in addedIds } // skip chains that are just updated

val removedDeferred = removedTrue.map {
async { connectionPool.getConnectionOrNull(it.id)?.socketService?.pause() }
}

Expand Down