From b0edfef6a9df14d9465b862918edd13723401650 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO <> Date: Wed, 29 May 2024 15:34:45 +1000 Subject: [PATCH] fix an issue when onboarding gets stuck in 421 loop when trying to fetch UserProfile config --- .../libsession/messaging/sending_receiving/pollers/Poller.kt | 4 ++++ .../src/main/java/org/session/libsession/snode/SnodeAPI.kt | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt index 39ed79de1e..6b9186708a 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt @@ -251,6 +251,10 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti responseList.getOrNull(personalResponseIndex)?.let { rawResponse -> if (rawResponse["code"] as? Int != 200) { Log.e("Loki", "Batch sub-request for personal messages had non-200 response code, returned code ${(rawResponse["code"] as? Int) ?: "[unknown]"}") + // If we got a non-success response then the snode might be bad so we should try rotate + // to a different one just in case + pollNextSnode(deferred) + return@bind Promise.ofSuccess(Unit) } else { val body = rawResponse["body"] as? RawResponse if (body == null) { diff --git a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt index 0f996bacac..e774d87a55 100644 --- a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt +++ b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt @@ -520,7 +520,7 @@ object SnodeAPI { Log.w("Loki", "response code was not 200") handleSnodeError( response["code"] as? Int ?: 0, - response, + response["body"] as? Map<*, *>, snode, publicKey )