From 5dca31e6f9db48873b487e8aace5bc6ae6b81d23 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 11 Apr 2019 16:23:34 +0200 Subject: [PATCH] Do not loop sync in case of JsonEncodingException (if HS is down) --- .../matrix/android/internal/session/sync/job/SyncThread.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/job/SyncThread.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/job/SyncThread.kt index fb5868a397..d70b1b211b 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/job/SyncThread.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/sync/job/SyncThread.kt @@ -16,6 +16,7 @@ package im.vector.matrix.android.internal.session.sync.job +import com.squareup.moshi.JsonEncodingException import im.vector.matrix.android.api.MatrixCallback import im.vector.matrix.android.api.failure.Failure import im.vector.matrix.android.api.util.Cancelable @@ -118,7 +119,8 @@ internal class SyncThread(private val syncTask: SyncTask, Timber.e(failure) } - if (failure !is Failure.NetworkConnection) { + if (failure !is Failure.NetworkConnection + || failure.cause is JsonEncodingException) { // Wait 10s before retrying sleep(RETRY_WAIT_TIME_MS) }