reverting unused error emissions
This commit is contained in:
parent
0020c29426
commit
f498840c17
|
@ -7,7 +7,7 @@ import app.dapk.st.matrix.common.matrixLog
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
|
||||||
internal class SideEffectFlowIterator(private val logger: MatrixLogger, private val errorTracker: ErrorTracker) {
|
internal class SideEffectFlowIterator(private val logger: MatrixLogger, private val errorTracker: ErrorTracker) {
|
||||||
suspend fun <T> loop(initial: T?, onPost: suspend (Throwable?) -> Unit, onIteration: suspend (T?) -> T?) {
|
suspend fun <T> loop(initial: T?, onPost: suspend () -> Unit, onIteration: suspend (T?) -> T?) {
|
||||||
var previousState = initial
|
var previousState = initial
|
||||||
|
|
||||||
while (currentCoroutineContext().isActive) {
|
while (currentCoroutineContext().isActive) {
|
||||||
|
@ -16,12 +16,11 @@ internal class SideEffectFlowIterator(private val logger: MatrixLogger, private
|
||||||
previousState = withContext(NonCancellable) {
|
previousState = withContext(NonCancellable) {
|
||||||
onIteration(previousState)
|
onIteration(previousState)
|
||||||
}
|
}
|
||||||
onPost(null)
|
onPost()
|
||||||
} catch (error: Throwable) {
|
} catch (error: Throwable) {
|
||||||
logger.matrixLog(SYNC, "on loop error: ${error.message}")
|
logger.matrixLog(SYNC, "on loop error: ${error.message}")
|
||||||
errorTracker.track(error, "sync loop error")
|
errorTracker.track(error, "sync loop error")
|
||||||
delay(10000L)
|
delay(10000L)
|
||||||
onPost(error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.matrixLog(SYNC, "isActive: ${currentCoroutineContext().isActive}")
|
logger.matrixLog(SYNC, "isActive: ${currentCoroutineContext().isActive}")
|
||||||
|
|
Loading…
Reference in New Issue