refactor: rendering pages as batch

pull/3285/head^2
David Silva 2 years ago
parent 6be80372ad
commit f2b1c1ffa6

@ -106,24 +106,30 @@ export async function build(
} }
} }
await Promise.all( const pages = ['404.md', ...siteConfig.pages]
['404.md', ...siteConfig.pages] const batchSize = 100
.map((page) => siteConfig.rewrites.map[page] || page)
.map((page) => for (let i = 0; i < pages.length; i += batchSize) {
renderPage( const batch = pages.slice(i, i + batchSize)
render, await Promise.all(
siteConfig, batch
page, .map((page) => siteConfig.rewrites.map[page] || page)
clientResult, .map((page) =>
appChunk, renderPage(
cssChunk, render,
assets, siteConfig,
pageToHashMap, page,
metadataScript, clientResult,
additionalHeadTags appChunk,
cssChunk,
assets,
pageToHashMap,
metadataScript,
additionalHeadTags
)
) )
) )
) }
}) })
// emit page hash map for the case where a user session is open // emit page hash map for the case where a user session is open

Loading…
Cancel
Save