Skip to content

Commit

Permalink
Try to fix and optimize the fetching code, part 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
KotlinGeekDev committed Dec 27, 2024
1 parent 9b5110f commit ba68b47
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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()
Expand Down

0 comments on commit ba68b47

Please sign in to comment.