From ba68b47d9f955a51207915cbda3e18135f1640fe Mon Sep 17 00:00:00 2001 From: KotlinGeekDev Date: Fri, 27 Dec 2024 21:27:53 +0100 Subject: [PATCH] Try to fix and optimize the fetching code, part 2. --- .../main/java/com/nononsenseapps/feeder/model/FeedParser.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nononsenseapps/feeder/model/FeedParser.kt b/app/src/main/java/com/nononsenseapps/feeder/model/FeedParser.kt index 877b0d740..7ae9cb1ed 100644 --- a/app/src/main/java/com/nononsenseapps/feeder/model/FeedParser.kt +++ b/app/src/main/java/com/nononsenseapps/feeder/model/FeedParser.kt @@ -311,7 +311,7 @@ class FeedParser(override val di: DI) : DIAware { val relaysToUse = if (relayList.any { (_, relayType) -> relayType == RelayMetadata.WRITE }) { relayList.filter { it.value == RelayMetadata.WRITE }.map { entry -> entry.key } - } else if (relayList.size < 7) { + } else if (relayList.size < 4) { relayList.map { entry -> entry.key } // This represents the relay URL, just as the operation above. } else { defaultArticleFetchRelays.map { it } @@ -331,7 +331,7 @@ class FeedParser(override val di: DI) : DIAware { logDebug(LOG_TAG, "Relay List size: -> ${relays.size}") nostrClient.removeAllRelays() - val relaysToUse = relays.take(2).plus(defaultArticleFetchRelays.random()) + val relaysToUse = relays.plus(defaultArticleFetchRelays.random()) .ifEmpty { defaultFetchRelays } relaysToUse.forEach { relay -> nostrClient.addReadRelay(relay) } nostrClient.connect()