Fine tune task weights + more measure
This commit is contained in:
parent
c9931e3ba3
commit
6cb94dd4d6
@ -39,39 +39,61 @@ internal class SyncResponseHandler @Inject constructor(private val roomSyncHandl
|
|||||||
Timber.v("Start handling sync, is InitialSync: $isInitialSync")
|
Timber.v("Start handling sync, is InitialSync: $isInitialSync")
|
||||||
val reporter = initialSyncProgressService.takeIf { isInitialSync }
|
val reporter = initialSyncProgressService.takeIf { isInitialSync }
|
||||||
|
|
||||||
if (!cryptoManager.isStarted()) {
|
measureTimeMillis {
|
||||||
Timber.v("Should start cryptoManager")
|
if (!cryptoManager.isStarted()) {
|
||||||
cryptoManager.start(isInitialSync)
|
Timber.v("Should start cryptoManager")
|
||||||
|
cryptoManager.start(isInitialSync)
|
||||||
|
}
|
||||||
|
}.also {
|
||||||
|
Timber.v("Finish handling start cryptoManager in $it ms")
|
||||||
}
|
}
|
||||||
val measure = measureTimeMillis {
|
val measure = measureTimeMillis {
|
||||||
// Handle the to device events before the room ones
|
// Handle the to device events before the room ones
|
||||||
// to ensure to decrypt them properly
|
// to ensure to decrypt them properly
|
||||||
Timber.v("Handle toDevice")
|
measureTimeMillis {
|
||||||
reportSubtask(reporter, R.string.initial_sync_start_importing_account_crypto, 100, 0.2f) {
|
Timber.v("Handle toDevice")
|
||||||
if (syncResponse.toDevice != null) {
|
reportSubtask(reporter, R.string.initial_sync_start_importing_account_crypto, 100, 0.1f) {
|
||||||
cryptoSyncHandler.handleToDevice(syncResponse.toDevice, reporter)
|
if (syncResponse.toDevice != null) {
|
||||||
}
|
cryptoSyncHandler.handleToDevice(syncResponse.toDevice, reporter)
|
||||||
}
|
}
|
||||||
Timber.v("Handle rooms")
|
|
||||||
|
|
||||||
reportSubtask(reporter, R.string.initial_sync_start_importing_account_rooms, 100, 0.5f) {
|
|
||||||
if (syncResponse.rooms != null) {
|
|
||||||
roomSyncHandler.handle(syncResponse.rooms, reporter)
|
|
||||||
}
|
}
|
||||||
|
}.also {
|
||||||
|
Timber.v("Finish handling toDevice in $it ms")
|
||||||
}
|
}
|
||||||
|
|
||||||
reportSubtask(reporter, R.string.initial_sync_start_importing_account_groups, 100, 0.2f) {
|
measureTimeMillis {
|
||||||
Timber.v("Handle groups")
|
Timber.v("Handle rooms")
|
||||||
if (syncResponse.groups != null) {
|
|
||||||
groupSyncHandler.handle(syncResponse.groups, reporter)
|
reportSubtask(reporter, R.string.initial_sync_start_importing_account_rooms, 100, 0.7f) {
|
||||||
|
if (syncResponse.rooms != null) {
|
||||||
|
roomSyncHandler.handle(syncResponse.rooms, reporter)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}.also {
|
||||||
|
Timber.v("Finish handling rooms in $it ms")
|
||||||
}
|
}
|
||||||
|
|
||||||
reportSubtask(reporter, R.string.initial_sync_start_importing_account_data, 100, 0.1f) {
|
|
||||||
Timber.v("Handle accountData")
|
measureTimeMillis {
|
||||||
if (syncResponse.accountData != null) {
|
reportSubtask(reporter, R.string.initial_sync_start_importing_account_groups, 100, 0.1f) {
|
||||||
userAccountDataSyncHandler.handle(syncResponse.accountData)
|
Timber.v("Handle groups")
|
||||||
|
if (syncResponse.groups != null) {
|
||||||
|
groupSyncHandler.handle(syncResponse.groups, reporter)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}.also {
|
||||||
|
Timber.v("Finish handling groups in $it ms")
|
||||||
|
}
|
||||||
|
|
||||||
|
measureTimeMillis {
|
||||||
|
reportSubtask(reporter, R.string.initial_sync_start_importing_account_data, 100, 0.1f) {
|
||||||
|
Timber.v("Handle accountData")
|
||||||
|
if (syncResponse.accountData != null) {
|
||||||
|
userAccountDataSyncHandler.handle(syncResponse.accountData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.also {
|
||||||
|
Timber.v("Finish handling accountData in $it ms")
|
||||||
}
|
}
|
||||||
|
|
||||||
Timber.v("On sync completed")
|
Timber.v("On sync completed")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user