diff --git a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesLceOperations.kt b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesLceOperations.kt index dbb73abf78..16052e2974 100644 --- a/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesLceOperations.kt +++ b/domain/tokens/src/main/kotlin/com/tangem/domain/tokens/operations/CurrenciesStatusesLceOperations.kt @@ -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, Either>> { 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 + } } \ No newline at end of file