diff --git a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/FlowIterator.kt b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/FlowIterator.kt index 71e5208..e10368d 100644 --- a/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/FlowIterator.kt +++ b/matrix/services/sync/src/main/kotlin/app/dapk/st/matrix/sync/internal/FlowIterator.kt @@ -7,7 +7,7 @@ import app.dapk.st.matrix.common.matrixLog import kotlinx.coroutines.* internal class SideEffectFlowIterator(private val logger: MatrixLogger, private val errorTracker: ErrorTracker) { - suspend fun loop(initial: T?, onPost: suspend (Throwable?) -> Unit, onIteration: suspend (T?) -> T?) { + suspend fun loop(initial: T?, onPost: suspend () -> Unit, onIteration: suspend (T?) -> T?) { var previousState = initial while (currentCoroutineContext().isActive) { @@ -16,12 +16,11 @@ internal class SideEffectFlowIterator(private val logger: MatrixLogger, private previousState = withContext(NonCancellable) { onIteration(previousState) } - onPost(null) + onPost() } catch (error: Throwable) { logger.matrixLog(SYNC, "on loop error: ${error.message}") errorTracker.track(error, "sync loop error") delay(10000L) - onPost(error) } } logger.matrixLog(SYNC, "isActive: ${currentCoroutineContext().isActive}")