mirror of
https://github.com/outline/outline.git
synced 2026-06-13 03:14:59 +03:00
fix: Potential task queue saturation in Notion importer (#11428)
* fix: Potential task queue saturation in Notion import * Reduces concurrent Notion API pressure from 3× the recursive call depth down to 1
This commit is contained in:
@@ -44,9 +44,10 @@ export default class NotionAPIImportTask extends APIImportTask<IntegrationServic
|
||||
|
||||
const client = new NotionClient(integration.authentication.token);
|
||||
|
||||
const parsedPages = await Promise.all(
|
||||
importTask.input.map(async (item) => 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[];
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user