mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 11:43:35 +00:00
Stop shuffling relays in sampleRelays
This commit is contained in:
parent
e24e77ed0b
commit
d6fb438ea0
@ -1,9 +1,6 @@
|
|||||||
# Current
|
# Current
|
||||||
|
|
||||||
- [ ] Collapse relaycard and relaycardsimple?
|
|
||||||
- [ ] Create my own version of nostr.how and extension explanation
|
- [ ] 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
|
- [ ] Go over onboarding process, suggest some good relays for newcomers
|
||||||
- [ ] Submit blog post with new onboarding process built in
|
- [ ] Submit blog post with new onboarding process built in
|
||||||
- [ ] Fix hover on notes in modal
|
- [ ] Fix hover on notes in modal
|
||||||
|
@ -155,10 +155,10 @@ export const sampleRelays = (relays, scale = 1) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove relays that are currently in an error state
|
// 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
|
// Limit target relays
|
||||||
relays = shuffle(relays).slice(0, limit)
|
relays = relays.slice(0, limit)
|
||||||
|
|
||||||
// If we're still under the limit, add user relays for good measure
|
// If we're still under the limit, add user relays for good measure
|
||||||
if (relays.length < limit) {
|
if (relays.length < limit) {
|
||||||
@ -180,7 +180,7 @@ export const aggregateScores = relayGroups => {
|
|||||||
|
|
||||||
for (const relays of relayGroups) {
|
for (const relays of relayGroups) {
|
||||||
for (const relay of relays) {
|
for (const relay of relays) {
|
||||||
const {url, score} = relay
|
const {url, score = 0.5} = relay
|
||||||
|
|
||||||
if (!scores[url]) {
|
if (!scores[url]) {
|
||||||
scores[url] = {score: 0, count: 0}
|
scores[url] = {score: 0, count: 0}
|
||||||
|
Loading…
Reference in New Issue
Block a user