Skip to content
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

Invoke issuing API requests on background thread #3507

Merged
merged 2 commits into from
Mar 23, 2021

Conversation

mshafrir-stripe
Copy link
Collaborator

Summary

Previously requests were being fired on the main thread
(runBlocking). Move requests to a background thread and dispatch
results on main thread.

Motivation

Fixes #3499

Testing

  • Added tests
  • Modified tests
  • Manually verified

Previously requests were being fired on the main thread
(`runBlocking`). Move requests to a background thread and dispatch
results on main thread.

Fixes #3499
@@ -8,15 +8,20 @@ import com.stripe.android.Stripe.Companion.appInfo
import com.stripe.android.exception.InvalidRequestException
import com.stripe.android.networking.StripeApiRepository
import com.stripe.android.networking.StripeRepository
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.CoroutineScope
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am curious how you found this? DO we have checks in place to make sure it doesn't happen other places?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a quick search, it looks like apart from the synchronous calls here, there is no prod code using runBlocking

@ccen-stripe
Copy link
Collaborator

LGTM

@mshafrir-stripe mshafrir-stripe merged commit 8e469a9 into master Mar 23, 2021
@mshafrir-stripe mshafrir-stripe deleted the fix-issuing-pin-service-blocking branch March 23, 2021 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PIN Management - Method "retrievePinCode" seems to block the main thread
4 participants