List followers/following uses cache and handle failures

pull/324/head
Sven Sauleau 2023-02-20 17:03:37 +00:00
rodzic 7c2a0f207d
commit cf8dede82d
2 zmienionych plików z 14 dodań i 6 usunięć

Wyświetl plik

@ -67,10 +67,14 @@ async function getLocalFollowers(request: Request, handle: Handle, db: D1Databas
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

@ -67,10 +67,14 @@ async function getLocalFollowing(request: Request, handle: Handle, db: D1Databas
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 = {