From aba2496f4f05f3a7d7495f04e47bd1cac10d7986 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 11 Jan 2021 23:14:58 -0500 Subject: [PATCH] Improve server startup time --- lib/activitypub/articles.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/activitypub/articles.ts b/lib/activitypub/articles.ts index 789cf44..33f22a1 100644 --- a/lib/activitypub/articles.ts +++ b/lib/activitypub/articles.ts @@ -9,9 +9,10 @@ const domain = process.env.DOMAIN; export async function setup(posts: Page[]) { const repository = getConnection().getRepository(Article); + const allPosts = await repository.find(); for (const post of posts) { const postMeta = post.metadata; - if (await repository.findOne(postMeta.permalink)) { + if (allPosts.some((p) => p.id === postMeta.permalink)) { continue; } const articleObject = {