From 23e71fe56f10965470cdca50bb82c0d0ce118d6e Mon Sep 17 00:00:00 2001 From: Carlos M Date: Fri, 23 Jun 2023 11:19:35 -0700 Subject: [PATCH] Updates comments. --- .../domain/PollAuthorizationSessionAccounts.kt | 2 +- .../domain/PollAuthorizationSessionOAuthResults.kt | 7 +------ .../stripe/android/financialconnections/utils/Errors.kt | 2 ++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionAccounts.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionAccounts.kt index a6bab5472ce..47cd6dedae5 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionAccounts.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionAccounts.kt @@ -20,7 +20,7 @@ import kotlin.time.Duration.Companion.seconds /** * Polls accounts from backend after authorization session completes. * - * Will retry upon 202 backend responses every [POLLING_TIME_MS] up to [MAX_TRIES] + * Will retry upon 202 backend responses. */ internal class PollAuthorizationSessionAccounts @Inject constructor( private val repository: FinancialConnectionsAccountsRepository, diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionOAuthResults.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionOAuthResults.kt index f08184e15a5..749296d4f06 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionOAuthResults.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/PollAuthorizationSessionOAuthResults.kt @@ -13,7 +13,7 @@ import kotlin.time.Duration.Companion.seconds /** * Polls OAuth results from backend after user finishes authorization on web browser. * - * Will retry upon 202 backend responses every [POLLING_TIME_MS] up to [MAX_TRIES] + * Will retry upon 202 backend responses. */ internal class PollAuthorizationSessionOAuthResults @Inject constructor( private val repository: FinancialConnectionsRepository, @@ -37,9 +37,4 @@ internal class PollAuthorizationSessionOAuthResults @Inject constructor( ) } } - - private companion object { - private const val POLLING_TIME_MS = 2000L - private const val MAX_TRIES = 300 - } } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/Errors.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/Errors.kt index 6d2a2b0c42c..0cdb601720d 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/Errors.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/utils/Errors.kt @@ -1,6 +1,7 @@ package com.stripe.android.financialconnections.utils import com.stripe.android.core.exception.StripeException +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.flow.channelFlow import kotlinx.coroutines.flow.first @@ -13,6 +14,7 @@ import kotlin.time.Duration.Companion.seconds * If the block execution fails, and [retryCondition] is met, the operation is retried. * Otherwise the resulting exception will be thrown. */ +@OptIn(ExperimentalCoroutinesApi::class) internal suspend fun retryOnException( options: PollTimingOptions, retryCondition: suspend (Throwable) -> Boolean,