Do not cancel current sync request when going to background #5621

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.
This commit is contained in:
Benoit Marty 2022-04-07 10:36:53 +02:00 committed by Benoit Marty
parent dbf10a222f
commit 03d6aa8cd3
2 changed files with 5 additions and 2 deletions

1
changelog.d/5719.feature Normal file
View File

@ -0,0 +1 @@
Do not cancel the current incremental sync request and treatment when the app goes to background

View File

@ -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.
}
}