Skip to content

Commit

Permalink
AND-9446 reload quotes on crash delay
Browse files Browse the repository at this point in the history
  • Loading branch information
kozarezvlad committed Dec 12, 2024
1 parent b6f0224 commit 7da0c46
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -215,4 +218,8 @@ internal class CurrenciesStatusesLceOperations(
else -> null
}
}

companion object {
private const val RETRY_QUOTES_DELAY = 2000L
}
}

0 comments on commit 7da0c46

Please # to comment.