Merge pull request #5719 from vector-im/feature/bma/improved_logs
Do not cancel the current sync request when the app goes to background
This commit is contained in:
commit
836a12d047
|
@ -0,0 +1 @@
|
|||
Do not cancel the current incremental sync request and treatment when the app goes to background
|
|
@ -597,11 +597,11 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
|
|||
sum.key = reaction
|
||||
sum.firstTimestamp = event.originServerTs ?: 0
|
||||
if (isLocalEcho) {
|
||||
Timber.v("Adding local echo reaction $reaction")
|
||||
Timber.v("Adding local echo reaction")
|
||||
sum.sourceLocalEcho.add(txId)
|
||||
sum.count = 1
|
||||
} else {
|
||||
Timber.v("Adding synced reaction $reaction")
|
||||
Timber.v("Adding synced reaction")
|
||||
sum.count = 1
|
||||
sum.sourceEvents.add(reactionEventId)
|
||||
}
|
||||
|
@ -613,16 +613,16 @@ internal class EventRelationsAggregationProcessor @Inject constructor(
|
|||
// check if it's not the sync of a local echo
|
||||
if (!isLocalEcho && sum.sourceLocalEcho.contains(txId)) {
|
||||
// ok it has already been counted, just sync the list, do not touch count
|
||||
Timber.v("Ignoring synced of local echo for reaction $reaction")
|
||||
Timber.v("Ignoring synced of local echo for reaction")
|
||||
sum.sourceLocalEcho.remove(txId)
|
||||
sum.sourceEvents.add(reactionEventId)
|
||||
} else {
|
||||
sum.count += 1
|
||||
if (isLocalEcho) {
|
||||
Timber.v("Adding local echo reaction $reaction")
|
||||
Timber.v("Adding local echo reaction")
|
||||
sum.sourceLocalEcho.add(txId)
|
||||
} else {
|
||||
Timber.v("Adding synced reaction $reaction")
|
||||
Timber.v("Adding synced reaction")
|
||||
sum.sourceEvents.add(reactionEventId)
|
||||
}
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ internal class DefaultFetchThreadTimelineTask @Inject constructor(
|
|||
sum = realm.createObject(ReactionAggregatedSummaryEntity::class.java)
|
||||
sum.key = reaction
|
||||
sum.firstTimestamp = event.originServerTs ?: 0
|
||||
Timber.v("Adding synced reaction $reaction")
|
||||
Timber.v("Adding synced reaction")
|
||||
sum.count = 1
|
||||
// reactionEventId not included in the /relations API
|
||||
// sum.sourceEvents.add(reactionEventId)
|
||||
|
|
|
@ -107,7 +107,6 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
|||
isInitialSync: Boolean,
|
||||
aggregator: SyncResponsePostTreatmentAggregator,
|
||||
reporter: ProgressReporter? = null) {
|
||||
Timber.v("Execute transaction from $this")
|
||||
handleRoomSync(realm, HandlingStrategy.JOINED(roomsSyncResponse.join), isInitialSync, aggregator, reporter)
|
||||
handleRoomSync(realm, HandlingStrategy.INVITED(roomsSyncResponse.invite), isInitialSync, aggregator, reporter)
|
||||
handleRoomSync(realm, HandlingStrategy.LEFT(roomsSyncResponse.leave), isInitialSync, aggregator, reporter)
|
||||
|
|
|
@ -104,10 +104,12 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
|
|||
|
||||
fun pause() = synchronized(lock) {
|
||||
if (isStarted) {
|
||||
Timber.tag(loggerTag.value).d("Pause sync...")
|
||||
Timber.tag(loggerTag.value).d("Pause sync... Not cancelling incremental sync")
|
||||
isStarted = false
|
||||
retryNoNetworkTask?.cancel()
|
||||
syncScope.coroutineContext.cancelChildren()
|
||||
// Do not cancel the current incremental sync.
|
||||
// Incremental sync can be long and it requires the user to wait for the treatment to end,
|
||||
// else all is restarted from the beginning each time the user moves the app to foreground.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,6 @@ for item in items:
|
|||
print("# " + item[0] + " (" + item[1] + ")")
|
||||
print("====================================================================================================")
|
||||
if item[2]:
|
||||
os.system("curl -s -X GET '" + item[1] + "' | python -m json.tool")
|
||||
os.system("curl -s -X GET '" + item[1] + "' | python3 -m json.tool")
|
||||
else:
|
||||
os.system("curl -s -X POST --data $'{}' '" + item[1] + "' | python -m json.tool")
|
||||
os.system("curl -s -X POST --data $'{}' '" + item[1] + "' | python3 -m json.tool")
|
||||
|
|
|
@ -230,13 +230,13 @@ class VectorApplication :
|
|||
val sdkVersion = Matrix.getSdkVersion()
|
||||
val date = SimpleDateFormat("MM-dd HH:mm:ss.SSSZ", Locale.US).format(Date())
|
||||
|
||||
Timber.v("----------------------------------------------------------------")
|
||||
Timber.v("----------------------------------------------------------------")
|
||||
Timber.v(" Application version: $appVersion")
|
||||
Timber.v(" SDK version: $sdkVersion")
|
||||
Timber.v(" Local time: $date")
|
||||
Timber.v("----------------------------------------------------------------")
|
||||
Timber.v("----------------------------------------------------------------\n\n\n\n")
|
||||
Timber.d("----------------------------------------------------------------")
|
||||
Timber.d("----------------------------------------------------------------")
|
||||
Timber.d(" Application version: $appVersion")
|
||||
Timber.d(" SDK version: $sdkVersion")
|
||||
Timber.d(" Local time: $date")
|
||||
Timber.d("----------------------------------------------------------------")
|
||||
Timber.d("----------------------------------------------------------------\n\n\n\n")
|
||||
}
|
||||
|
||||
override fun attachBaseContext(base: Context) {
|
||||
|
|
Loading…
Reference in New Issue