Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-12 14:00:35 +03:00
parent d4bafed03c
commit 672f65984f

View file

@ -18,6 +18,7 @@ import com.tangem.domain.tokens.repository.NetworksRepository
import com.tangem.domain.tokens.repository.QuotesRepository
import com.tangem.domain.wallets.models.UserWalletId
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
internal class CurrenciesStatusesLceOperations(
@ -169,6 +170,8 @@ internal class CurrenciesStatusesLceOperations(
.map<Set<Quote>, Either<TokenListError, Set<Quote>>> { it.right() }
.retryWhen { cause, _ ->
emit(TokenListError.DataError(cause).left())
// adding delay before retry to avoid spam when flow restarted
delay(RETRY_QUOTES_DELAY)
true
}
.distinctUntilChanged()
@ -215,4 +218,8 @@ internal class CurrenciesStatusesLceOperations(
else -> null
}
}
companion object {
private const val RETRY_QUOTES_DELAY = 2000L
}
}