Stop shuffling relays in sampleRelays

This commit is contained in:
Jonathan Staab 2023-03-08 16:11:27 -06:00
parent e24e77ed0b
commit d6fb438ea0
2 changed files with 4 additions and 7 deletions

View File

@ -1,9 +1,6 @@
# Current
- [ ] Collapse relaycard and relaycardsimple?
- [ ] Create my own version of nostr.how and extension explanation
- [ ] Review sampleRelays, seems like we shouldn't be shuffling
- [ ] Go over onboarding process, suggest some good relays for newcomers
- [ ] Submit blog post with new onboarding process built in
- [ ] Fix hover on notes in modal

View File

@ -155,10 +155,10 @@ export const sampleRelays = (relays, scale = 1) => {
}
// Remove relays that are currently in an error state
relays => relays.filter(r => pool.getConnection(r.url)?.hasRecentError())
relays = relays.filter(r => pool.getConnection(r.url)?.hasRecentError())
// Shuffle and limit target relays
relays = shuffle(relays).slice(0, limit)
// Limit target relays
relays = relays.slice(0, limit)
// If we're still under the limit, add user relays for good measure
if (relays.length < limit) {
@ -180,7 +180,7 @@ export const aggregateScores = relayGroups => {
for (const relays of relayGroups) {
for (const relay of relays) {
const {url, score} = relay
const {url, score = 0.5} = relay
if (!scores[url]) {
scores[url] = {score: 0, count: 0}