From 82c29e9f857067042dc9f626906d768286dfde39 Mon Sep 17 00:00:00 2001 From: SessionHero01 <180888785+SessionHero01@users.noreply.github.com> Date: Fri, 14 Mar 2025 12:42:22 +1100 Subject: [PATCH] Move getSwarm into try catch (#1021) --- .../sending_receiving/pollers/Poller.kt | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) 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 bed4f6f528..d99379f877 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 @@ -107,21 +107,20 @@ class Poller( Log.d(TAG, "Polling...") isPolling = true + var pollDelay = RETRY_INTERVAL_MS + try { + // check if the polling pool is empty + if (pollPool.isEmpty()){ + // if it is empty, fill it with the snodes from our swarm + pollPool.addAll(SnodeAPI.getSwarm(userPublicKey).await()) + } - // check if the polling pool is empty - if(pollPool.isEmpty()){ - // if it is empty, fill it with the snodes from our swarm - pollPool.addAll(SnodeAPI.getSwarm(userPublicKey).await()) - } - - // randomly get a snode from the pool - val currentNode = pollPool.random() + // randomly get a snode from the pool + val currentNode = pollPool.random() - // remove that snode from the pool - pollPool.remove(currentNode) + // remove that snode from the pool + pollPool.remove(currentNode) - var pollDelay = RETRY_INTERVAL_MS - try { poll(currentNode) retryScalingFactor = 1f } catch (e: Exception){