-
Notifications
You must be signed in to change notification settings - Fork 749
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
Feature/bma/incr sync perf #6917
Conversation
...oid/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt
Outdated
Show resolved
Hide resolved
@@ -180,8 +182,14 @@ internal class RoomSummaryUpdater @Inject constructor( | |||
roomSummaryEntity.otherMemberIds.clear() | |||
roomSummaryEntity.otherMemberIds.addAll(otherRoomMembers) | |||
if (roomSummaryEntity.isEncrypted && otherRoomMembers.isNotEmpty()) { | |||
// mmm maybe we could only refresh shield instead of checking trust also? | |||
crossSigningService.onUsersDeviceUpdate(otherRoomMembers) | |||
if (aggregator == null) { |
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 struggle to understand why using the aggregator
changes something here. Seeing the implementation of onUsersDeviceUpdate
, I see we only schedule a worker we should not take so much time, right?
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.
In the current code, crossSigningService.onUsersDeviceUpdate(otherRoomMembers)
is called once per room.
With the new code this is called once per sync response (which can contains many rooms)
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.
Okay thanks for explaining.
import javax.inject.Inject | ||
|
||
internal class SyncResponsePostTreatmentAggregatorHandler @Inject constructor( | ||
private val directChatsHelper: DirectChatsHelper, | ||
private val ephemeralTemporaryStore: RoomSyncEphemeralTemporaryStore, | ||
private val updateUserAccountDataTask: UpdateUserAccountDataTask, | ||
private val getProfileInfoTask: GetProfileInfoTask, | ||
@SessionDatabase private val monarchy: Monarchy, | ||
private val crossSigningService: DefaultCrossSigningService, |
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.
Why do we inject the DefaultCrossSigningService
instead of the interface? Should the interface DeviceListManager.UserDevicesUpdateListener
be implemented by CrossSigningService
instead?
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.
The arch is not really clean, we have exception for the crypto code.
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 to me.
Maybe we could just do some renaming: We could rename onUsersDeviceUpdate
in CrossSigningService in checkTrustAndAffectedRoomShiels
.
And this new method would be called by the aggregator when some room membership as changed, and also as a DeviceListManager listener, when the user has some changes in keys (new device, new cross signing...)
...oid/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryUpdater.kt
Outdated
Show resolved
Hide resolved
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.
Could not really test if sync is faster but okay for me.
Thanks. a8eb7d9 |
SonarCloud Quality Gate failed. |
This is not the same test failing. This time this is:
I am going to merge this PR as the fixes are highly expected. |
Type of change
Content
Improve incremental sync performance by moving some work in the background.
Motivation and context
Fix #6027
A large incr sync is roughly passing from 70s to 8s here.
Screenshots / GIFs
Tests
Tested devices
Checklist