kopia lustrzana https://github.com/cloudflare/wildebeest
				
				
				
			Merge pull request #324 from cloudflare/sven/follow-cache-and-handle-failure
List followers/following uses cache and handle failuressven/neon
						commit
						2beb65f9e2
					
				|  | @ -68,10 +68,14 @@ async function getLocalFollowers(request: Request, handle: Handle, db: Database) | ||||||
| 
 | 
 | ||||||
| 	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) | 
 | ||||||
| 		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 = { | 	const headers = { | ||||||
|  |  | ||||||
|  | @ -68,10 +68,14 @@ async function getLocalFollowing(request: Request, handle: Handle, db: Database) | ||||||
| 
 | 
 | ||||||
| 	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) | 
 | ||||||
| 		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 = { | 	const headers = { | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Sven Sauleau
						Sven Sauleau