Improve server startup time
This commit is contained in:
parent
96c14c068a
commit
aba2496f4f
|
@ -9,9 +9,10 @@ const domain = process.env.DOMAIN;
|
||||||
|
|
||||||
export async function setup(posts: Page[]) {
|
export async function setup(posts: Page[]) {
|
||||||
const repository = getConnection().getRepository(Article);
|
const repository = getConnection().getRepository(Article);
|
||||||
|
const allPosts = await repository.find();
|
||||||
for (const post of posts) {
|
for (const post of posts) {
|
||||||
const postMeta = <PostMetadata>post.metadata;
|
const postMeta = <PostMetadata>post.metadata;
|
||||||
if (await repository.findOne(postMeta.permalink)) {
|
if (allPosts.some((p) => p.id === postMeta.permalink)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const articleObject = {
|
const articleObject = {
|
||||||
|
|
Loading…
Reference in New Issue