Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Benoit Marty 2019-07-18 10:58:40 +02:00
commit 49ae954183

View File

@ -54,8 +54,9 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
updateStateTo(SyncState.IDLE) updateStateTo(SyncState.IDLE)
} }


fun setInitialForeground(initialForground : Boolean) { fun setInitialForeground(initialForeground: Boolean) {
updateStateTo(if (initialForground) SyncState.IDLE else SyncState.PAUSED) val newState = if (initialForeground) SyncState.IDLE else SyncState.PAUSED
updateStateTo(newState)
} }


fun restart() = synchronized(lock) { fun restart() = synchronized(lock) {
@ -96,7 +97,9 @@ internal class SyncThread @Inject constructor(private val syncTask: SyncTask,
lock.wait() lock.wait()
} }
} else { } else {
if (state !is SyncState.RUNNING) {
updateStateTo(SyncState.RUNNING(catchingUp = true)) updateStateTo(SyncState.RUNNING(catchingUp = true))
}
Timber.v("[$this] Execute sync request with timeout $DEFAULT_LONG_POOL_TIMEOUT") Timber.v("[$this] Execute sync request with timeout $DEFAULT_LONG_POOL_TIMEOUT")
val latch = CountDownLatch(1) val latch = CountDownLatch(1)
val params = SyncTask.Params(DEFAULT_LONG_POOL_TIMEOUT) val params = SyncTask.Params(DEFAULT_LONG_POOL_TIMEOUT)