Skip to content

refactor(@angular/build): support supplying worker pool to i18n inliner - #34084

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:refactor/i18n-inliner-worker-pool
Open

clydin wants to merge 1 commit into
angular:mainfrom
clydin:refactor/i18n-inliner-worker-pool

Conversation

@clydin

@clydin clydin commented Sep 11, 2026

Copy link
Copy Markdown
Member

The I18nInliner class previously created a dedicated WorkerPool instance on every construction and unconditionally destroyed it when closed. In watch mode and across build executions, this led to unnecessary worker thread lifecycle overhead and prevented reusing existing thread pools across post-bundle phases.

This change updates the I18nInliner constructor to accept an optional workerPool argument directly as a second parameter. When provided, the supplied worker pool is used for all transformation task executions and is treated as an external borrowed dependency that is not destroyed when close is invoked. When omitted, the inliner continues to create and manage its own dedicated worker pool as before.

The inlineI18n application builder helper is also updated to accept an optional workerPool parameter and forward it to the inliner constructor, enabling callers and future shared build orchestration to pass through a common worker pool.

@clydin clydin added the target: minor This PR is targeted for the next minor release label Sep 15, 2026
@clydin
clydin marked this pull request as ready for review September 15, 2026 20:30

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enables I18nInliner to accept an optional, externally managed WorkerPool. When provided, the inliner uses this shared pool for translation tasks and avoids destroying it upon calling close(). The feedback suggests conditionally setting maxConcurrency to undefined when a shared workerPool is present to prevent mismatches between the inliner's partitioning logic and the pool's actual capacity.

Comment thread packages/angular/build/src/builders/application/i18n.ts
The I18nInliner class previously created a dedicated WorkerPool instance on every construction and unconditionally destroyed it when closed. In watch mode and across build executions, this led to unnecessary worker thread lifecycle overhead and prevented reusing existing thread pools across post-bundle phases.

This change updates the I18nInliner constructor to accept an optional workerPool argument directly as a second parameter. When provided, the supplied worker pool is used for all transformation task executions and is treated as an external borrowed dependency that is not destroyed when close is invoked. When omitted, the inliner continues to create and manage its own dedicated worker pool as before.

The inlineI18n application builder helper is also updated to accept an optional workerPool parameter and forward it to the inliner constructor, enabling callers and future shared build orchestration to pass through a common worker pool.
@clydin
clydin force-pushed the refactor/i18n-inliner-worker-pool branch from 1713a1e to 368c06f Compare September 15, 2026 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/build target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant