Skip to content

Commit

Permalink
perf(v2): convert synchronous filewrite to asynchronous in feed file …
Browse files Browse the repository at this point in the history
…generate

This looks like should return a Promise list , other than a sync io operation
  • Loading branch information
moonrailgun committed Jun 15, 2020
1 parent 1fdc8c5 commit 053c507
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/docusaurus-plugin-content-blog/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,9 @@ export default function pluginContentBlog(
`${feedType}.xml`,
);
const feedContent = feedType === 'rss' ? feed.rss2() : feed.atom1();
try {
fs.writeFileSync(feedPath, feedContent);
} catch (err) {
return fs.outputFile(feedPath, feedContent).catch((err) => {
throw new Error(`Generating ${feedType} feed failed: ${err}`);
}
});
}),
);
},
Expand Down

0 comments on commit 053c507

Please sign in to comment.