mirror of
https://github.com/coracle-social/flotilla.git
synced 2025-12-10 10:57:04 +00:00
Fix freshness persistence, optimize pubkey loading
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {get} from "svelte/store"
|
||||
import {ctx, uniq, sleep, chunk, equals, choice} from "@welshman/lib"
|
||||
import {ctx, sample, uniq, sleep, chunk, equals, choice} from "@welshman/lib"
|
||||
import {
|
||||
DELETE,
|
||||
PROFILE,
|
||||
@@ -169,16 +169,19 @@ export const loadUserData = (
|
||||
]),
|
||||
])
|
||||
|
||||
// Load followed profiles slowly in the background without clogging other stuff up
|
||||
// Load followed profiles slowly in the background without clogging other stuff up. Only use a single
|
||||
// indexer relay to avoid too many redundant validations, which slow things down and eat bandwidth
|
||||
promise.then(async () => {
|
||||
for (const pubkeys of chunk(50, getDefaultPubkeys())) {
|
||||
await sleep(300)
|
||||
const relays = sample(1, INDEXER_RELAYS)
|
||||
|
||||
await sleep(1000)
|
||||
|
||||
for (const pubkey of pubkeys) {
|
||||
loadMembership(pubkey)
|
||||
loadProfile(pubkey)
|
||||
loadFollows(pubkey)
|
||||
loadMutes(pubkey)
|
||||
loadMembership(pubkey, {relays})
|
||||
loadProfile(pubkey, {relays})
|
||||
loadFollows(pubkey, {relays})
|
||||
loadMutes(pubkey, {relays})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
const migrateFreshness = (data: {key: string; value: number}[]) => {
|
||||
const cutoff = ago(HOUR)
|
||||
|
||||
return data.filter(({value}) => value < cutoff)
|
||||
return data.filter(({value}) => value > cutoff)
|
||||
}
|
||||
|
||||
const migratePlaintext = (data: {key: string; value: number}[]) => data.slice(0, 10_000)
|
||||
|
||||
Reference in New Issue
Block a user