kopia lustrzana https://github.com/cloudflare/wildebeest
List followers/following uses cache and handle failures
rodzic
7c2a0f207d
commit
cf8dede82d
|
@ -67,10 +67,14 @@ async function getLocalFollowers(request: Request, handle: Handle, db: D1Databas
|
||||||
|
|
||||||
for (let i = 0, len = followers.length; i < len; i++) {
|
for (let i = 0, len = followers.length; i < len; i++) {
|
||||||
const id = new URL(followers[i])
|
const id = new URL(followers[i])
|
||||||
|
|
||||||
const acct = urlToHandle(id)
|
const acct = urlToHandle(id)
|
||||||
const actor = await actors.get(id)
|
|
||||||
|
try {
|
||||||
|
const actor = await actors.getAndCache(id, db)
|
||||||
out.push(await loadExternalMastodonAccount(acct, actor))
|
out.push(await loadExternalMastodonAccount(acct, actor))
|
||||||
|
} catch (err: any) {
|
||||||
|
console.warn(`failed to retrieve follower (${id}): ${err.message}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
|
|
|
@ -67,10 +67,14 @@ async function getLocalFollowing(request: Request, handle: Handle, db: D1Databas
|
||||||
|
|
||||||
for (let i = 0, len = following.length; i < len; i++) {
|
for (let i = 0, len = following.length; i < len; i++) {
|
||||||
const id = new URL(following[i])
|
const id = new URL(following[i])
|
||||||
|
|
||||||
const acct = urlToHandle(id)
|
const acct = urlToHandle(id)
|
||||||
const actor = await actors.get(id)
|
|
||||||
|
try {
|
||||||
|
const actor = await actors.getAndCache(id, db)
|
||||||
out.push(await loadExternalMastodonAccount(acct, actor))
|
out.push(await loadExternalMastodonAccount(acct, actor))
|
||||||
|
} catch (err: any) {
|
||||||
|
console.warn(`failed to retrieve following (${id}): ${err.message}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
|
|
Ładowanie…
Reference in New Issue