Add an option in the astro config build object to set concurrency
Changes
This makes concurrency optional using the implementation that was removed before. By default still use a concurrency of 1 and does not change anything in the build.
One can set it in their astro.config.mjs:
export default defineConfig({
// integrations: [...],
build: {
concurrency: 8,
}
// adapter: ...
});
Signed-off-by: Jeremy Wickersheimer [email protected]
Testing
Tested with a very large build that has >300k pages (mostly all in one URL pattern). Manages to reduce the total build from 6000s to 3000s with a concurrency of 8.
Docs
May need a Doc update to mention the new setting.
🦋 Changeset detected
Latest commit: 9d864c023158e575d26af92c3df93e3172478b25
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 12 packages
| Name | Type |
|---|---|
| astro | Minor |
| @e2e/astro-component | Patch |
| @e2e/error-react-spectrum | Patch |
| @e2e/error-sass | Patch |
| @e2e/errors | Patch |
| @e2e/lit-component | Patch |
| @e2e/preact-component | Patch |
| @e2e/react-component | Patch |
| @e2e/solid-component | Patch |
| @e2e/svelte-component | Patch |
| @e2e/e2e-tailwindcss | Patch |
| @e2e/ts-resolution | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
I've also changed the way tasks are processed to use Promise.race instead of Promise.all as this allows the tasks to be queued as soon as one completes instead of batching them in a fixed array where Promise.all would 'block' until the batch was completed.
Let's move the config option to build.concurrency as @FredKSchott suggested, then we can merge. cc @jwickers
@matthewp ~~from my understanding that was already done? https://github.com/withastro/astro/pull/4052/files#diff-10cec9990a82f35ed4ce5e0137005fc5035b0291910a4162f1ff0c5adbf2a8efR171~~
Disregard, it's currently a top-level option!
It's been 2 weeks without an update so I'm going to close this PR. Please feel free to reopen if you change where the config option lives. Thanks!
Hi, sorry, I've been out for the summer. I rebased it to the latest main branch and checked that it was still working for my use case.
I've updated the PR description to where the config lives, I had moved it to be in the main config object already. But let me know if you meant to move it somewhere else.