-
Notifications
You must be signed in to change notification settings - Fork 855
Make cryptoDevice calls suspendable #8485
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
Conversation
bmarty
left a comment
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.
LGTM, some small remarks.
| it.deviceId != session.sessionParams.deviceId | ||
| } | ||
| setState { copy(hasAnyOtherSession = Loading()) } | ||
| viewModelScope.launch(Dispatchers.IO) { |
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.
I think it's not mandatory to provide a dispatcher here, getCryptoDeviceInfo will switch to this dispatcher using withContext.
| pushersManager.enqueueRegisterPusher(pushKey, gateway) | ||
| runBlocking { | ||
| pushersManager.enqueueRegisterPusher(pushKey, gateway) | ||
| } |
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.
Instead of using runBlocking, I think we should use runTest, so update the method declaration like this:
fun `when enqueueRegisterPusher, then HttpPusher created and enqueued`() = runTest {| @Test | ||
| fun `when execute, then get crypto device info`() { | ||
| val result = getDeviceInfoUseCase.execute() | ||
| val result = runBlocking { getDeviceInfoUseCase.execute() } |
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.
use runTest instead of runBlocking:
fun `when execute, then get crypto device info`() = runTest {3ea8b63 to
7e6376b
Compare
|
SonarCloud Quality Gate failed. |








Type of change
Content
Fixes #8482
getCryptoDevicecalls in rust are usingrunBlocking, it was causing ANRs. These calls are now suspendable, updated the code accordingly.Additional change in ReadService on
getHomeServerCapabilities()that was also causing ANRs.Motivation and context
Screenshots / GIFs
Tests
Tested devices
Checklist