From 3fda23c7dd9b2a07851ade11dedcc5f54a5ec703 Mon Sep 17 00:00:00 2001 From: April John Date: Mon, 8 May 2023 22:46:51 +0200 Subject: [PATCH] Revert "fix: run post import async" This reverts commit 3bedd1b34799d969cd218b4a1a67651532a204e6. --- .../src/queue/processors/db/import-posts.ts | 82 +++++++++---------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/packages/backend/src/queue/processors/db/import-posts.ts b/packages/backend/src/queue/processors/db/import-posts.ts index 73cec113e..47096d414 100644 --- a/packages/backend/src/queue/processors/db/import-posts.ts +++ b/packages/backend/src/queue/processors/db/import-posts.ts @@ -81,49 +81,47 @@ export async function importPosts( } else if (parsed instanceof Object) { logger.info("Parsing animal style posts"); for (const post of parsed.orderedItems) { - async () => { - try { - linenum++; - let reply: Note | null = null; - if (post.object.inReplyTo != null) { - reply = await resolveNote(post.object.inReplyTo); - } - if (post.directMessage) { - return; - } - if (job.data.signatureCheck) { - if (!post.signature) { - return; - } - } - let text; - try { - text = htmlToMfm(post.object.content, post.object.tag); - } catch (e) { - return; - } - logger.info(`Posting[${linenum}] ...`); - - const note = await create(user, { - createdAt: new Date(post.object.published), - files: undefined, - poll: undefined, - text: text || undefined, - reply, - renote: null, - cw: post.sensitive, - localOnly: false, - visibility: "hidden", - visibleUsers: [], - channel: null, - apMentions: new Array(0), - apHashtags: undefined, - apEmojis: undefined, - }); - } catch (e) { - logger.warn(`Error in line:${linenum} ${e}`); + try { + linenum++; + let reply: Note | null = null; + if (post.object.inReplyTo != null) { + reply = await resolveNote(post.object.inReplyTo); } - }; + if (post.directMessage) { + continue; + } + if (job.data.signatureCheck) { + if (!post.signature) { + continue; + } + } + let text; + try { + text = htmlToMfm(post.object.content, post.object.tag); + } catch (e) { + continue; + } + logger.info(`Posting[${linenum}] ...`); + + const note = await create(user, { + createdAt: new Date(post.object.published), + files: undefined, + poll: undefined, + text: text || undefined, + reply, + renote: null, + cw: post.sensitive, + localOnly: false, + visibility: "hidden", + visibleUsers: [], + channel: null, + apMentions: new Array(0), + apHashtags: undefined, + apEmojis: undefined, + }); + } catch (e) { + logger.warn(`Error in line:${linenum} ${e}`); + } } } } catch (e) {