diff --git a/plugins/notion/server/tasks/NotionAPIImportTask.ts b/plugins/notion/server/tasks/NotionAPIImportTask.ts index b433a5681b..768263ab7e 100644 --- a/plugins/notion/server/tasks/NotionAPIImportTask.ts +++ b/plugins/notion/server/tasks/NotionAPIImportTask.ts @@ -44,9 +44,10 @@ export default class NotionAPIImportTask extends APIImportTask this.processPage({ item, client })) - ); + const parsedPages: (ParsePageOutput | null)[] = []; + for (const item of importTask.input) { + parsedPages.push(await this.processPage({ item, client })); + } // Filter out any null results (from pages/databases that couldn't be accessed) const validParsedPages = parsedPages.filter(Boolean) as ParsePageOutput[]; diff --git a/server/queues/tasks/APIImportTask.ts b/server/queues/tasks/APIImportTask.ts index cb481417cf..7d1b0ab9c9 100644 --- a/server/queues/tasks/APIImportTask.ts +++ b/server/queues/tasks/APIImportTask.ts @@ -327,11 +327,7 @@ export default abstract class APIImportTask< const uploadItems = Object.entries(urlToAttachment).map( ([url, attachment]) => ({ attachmentId: attachment.id, url }) ); - // publish task after attachments are persisted in DB. - const job = await new UploadAttachmentsForImportTask().schedule( - uploadItems - ); - await job.finished(); + await new UploadAttachmentsForImportTask().schedule(uploadItems); } catch (err) { // upload attachments failure is not critical enough to fail the whole import. Logger.error(