diff --git a/src/dispatchers.ts b/src/dispatchers.ts index 50fec36c..c88c859c 100644 --- a/src/dispatchers.ts +++ b/src/dispatchers.ts @@ -252,38 +252,17 @@ export async function followersDispatcher( handle: string, ) { console.log('Followers Dispatcher'); - let items: Recipient[] = []; - console.time('Followers dispatcher'); - console.time('Getting expanded followers'); - const fullResults = await ctx.data.db.get(['followers', 'expanded']); - console.timeEnd('Getting expanded followers'); - if (fullResults) { - console.time(`Creating Objects`); - items = (await Promise.all( - fullResults.map((result, i): Promise => { - return { - ...result, - id: new URL(result.id), - inboxId: new URL(result.inbox) - }; - }) - )); - console.timeEnd(`Creating Objects`); - } else { - const results = (await ctx.data.db.get(['followers'])) || []; - const actors = items = (await Promise.all(results.map((result) => lookupActor(ctx, result)))) - .filter((item): item is Actor => item !== null) - const toStore = await Promise.all(actors.map(actor => actor.toJsonLd() as any)); - await ctx.data.db.set(['followers', 'expanded'], toStore); - items = toStore.map((result) => { - return { - ...result, - id: new URL(result.id), - inboxId: new URL(result.inbox) - }; - }); - } - console.timeEnd('Followers dispatcher'); + const results = (await ctx.data.db.get(['followers'])) || []; + const actors = (await Promise.all(results.map((result) => lookupActor(ctx, result)))) + .filter((item): item is Actor => item !== null) + const toStore = await Promise.all(actors.map(actor => actor.toJsonLd() as any)); + const items = toStore.map((result) => { + return { + ...result, + id: new URL(result.id), + inboxId: new URL(result.inbox) + }; + }); return { items, };