Fixes lingering relays on loading follows outbox relays.

This commit is contained in:
Vitor Pamplona
2026-03-11 13:17:06 -04:00
2 changed files with 8 additions and 2 deletions
@@ -24,6 +24,7 @@ import com.vitorpamplona.amethyst.commons.relayClient.eoseManagers.IEoseManager
import com.vitorpamplona.amethyst.isDebug
import com.vitorpamplona.amethyst.model.Account
import com.vitorpamplona.amethyst.model.LocalCache
import com.vitorpamplona.amethyst.model.LocalCache.users
import com.vitorpamplona.amethyst.model.User
import com.vitorpamplona.amethyst.service.BundledUpdate
import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.AccountQueryState
@@ -150,7 +151,10 @@ class AccountFollowsLoaderSubAssembler(
}
}
if (users.isEmpty()) return null
if (users.isEmpty()) {
hasTried.removeEveryoneBut(emptySet())
return null
}
val connectedRelays = client.connectedRelaysFlow().value
@@ -73,6 +73,7 @@ fun pickRelaysToLoadUsers(
searchRelays - cannotConnectRelays,
connected,
commonRelays - cannotConnectRelays,
cannotConnectRelays,
hasTried,
)
}
@@ -84,11 +85,12 @@ fun pickRelaysToLoadUsers(
searchRelays: Set<NormalizedRelayUrl>,
connected: Set<NormalizedRelayUrl>,
commonRelays: Set<NormalizedRelayUrl>,
cannotConnectRelays: Set<NormalizedRelayUrl>,
hasTried: EOSEAccountFast<User>,
): Map<NormalizedRelayUrl, Set<HexKey>> =
mapOfSet {
users.forEachIndexed { idx, key ->
val tried = hasTried.since(key)?.keys ?: emptySet()
val tried = (hasTried.since(key)?.keys ?: emptySet()) + cannotConnectRelays
val outbox = key.authorRelayList()?.writeRelaysNorm()