Merge pull request #324 from cloudflare/sven/follow-cache-and-handle-failure

List followers/following uses cache and handle failures
sven/neon
Sven Sauleau 2023-02-24 10:31:13 +01:00 zatwierdzone przez GitHub
commit 2beb65f9e2
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 14 dodań i 6 usunięć

Wyświetl plik

@ -68,10 +68,14 @@ async function getLocalFollowers(request: Request, handle: Handle, db: Database)
for (let i = 0, len = followers.length; i < len; i++) {
const id = new URL(followers[i])
const acct = urlToHandle(id)
const actor = await actors.get(id)
out.push(await loadExternalMastodonAccount(acct, actor))
try {
const actor = await actors.getAndCache(id, db)
out.push(await loadExternalMastodonAccount(acct, actor))
} catch (err: any) {
console.warn(`failed to retrieve follower (${id}): ${err.message}`)
}
}
const headers = {

Wyświetl plik

@ -68,10 +68,14 @@ async function getLocalFollowing(request: Request, handle: Handle, db: Database)
for (let i = 0, len = following.length; i < len; i++) {
const id = new URL(following[i])
const acct = urlToHandle(id)
const actor = await actors.get(id)
out.push(await loadExternalMastodonAccount(acct, actor))
try {
const actor = await actors.getAndCache(id, db)
out.push(await loadExternalMastodonAccount(acct, actor))
} catch (err: any) {
console.warn(`failed to retrieve following (${id}): ${err.message}`)
}
}
const headers = {