-
Notifications
You must be signed in to change notification settings - Fork 658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Replicate other platforms polling logic across the AuthFlow #6919
[Android] Replicate other platforms polling logic across the AuthFlow #6919
Conversation
internal class FetchNetworkedAccounts @Inject constructor( | ||
private val repository: FinancialConnectionsAccountsRepository, | ||
private val configuration: FinancialConnectionsSheet.Configuration | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just renamed from PollNetworkedAccounts. No polling needed here.
33bc8fc
to
114f16c
Compare
private fun FinancialConnectionsAuthorizationSession.Flow?.toPollIntervalMs(): Long { | ||
val defaultInitialPollDelay: Long = 1.75.seconds.inWholeMilliseconds | ||
return when (this) { | ||
FinancialConnectionsAuthorizationSession.Flow.TESTMODE, | ||
FinancialConnectionsAuthorizationSession.Flow.TESTMODE_OAUTH, | ||
FinancialConnectionsAuthorizationSession.Flow.TESTMODE_OAUTH_WEBVIEW, | ||
FinancialConnectionsAuthorizationSession.Flow.FINICITY_CONNECT_V2_LITE -> { | ||
// Post auth flow, Finicity non-OAuth account retrieval latency is extremely quick - p90 < 1sec. | ||
0 | ||
} | ||
|
||
FinancialConnectionsAuthorizationSession.Flow.MX_CONNECT -> { | ||
// 10 account retrieval latency on MX non-OAuth sessions is currently 460 ms | ||
0.5.seconds.inWholeMilliseconds | ||
} | ||
|
||
private companion object { | ||
private const val POLLING_TIME_MS = 2000L | ||
private const val MAX_TRIES = 10 | ||
else -> defaultInitialPollDelay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replicated from iOS. Each flow has an optimal initial delay.
7570ec0
to
3517bb5
Compare
return retryOnException( | ||
times = MAX_TRIES, | ||
delayMilliseconds = POLLING_TIME_MS, | ||
): PartnerAccountsList = try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try now wraps the retryOnException
execution, so that toDomainException
also maps retry exceptions.
…7171/android-replicate-other-platforms-polling-logic-ac
Co-authored-by: Till Hellmund <tillh@stripe.com>
Summary
Replicates polling logic from iOS / Web:
Aditionally, throws a retryable, known
StripeException
,PollingReachedMaxRetriesException
, instead ofjava.concurrent.TimeoutException
. There's code in place to allow user to try again on known exceptions.Before, the user would just be able to close the flow. Now the user will be able to try again or select another bank.
polling.mp4
Motivation
📔 [Android] Replicate other platforms' polling logic across the AuthFlow
🌐 BANKCON-7171
Testing