diff --git a/changelog.d/5719.feature b/changelog.d/5719.feature new file mode 100644 index 00000000000..7561dfd82fd --- /dev/null +++ b/changelog.d/5719.feature @@ -0,0 +1 @@ +Do not cancel the current incremental sync request and treatment when the app goes to background \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt index 2460720adc6..204c26a8d60 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/job/SyncThread.kt @@ -107,7 +107,11 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask, Timber.tag(loggerTag.value).d("Pause 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. + Timber.tag(loggerTag.value).d("Pause sync... Not cancelling incremental sync") + // syncScope.coroutineContext.cancelChildren() } }