Skip to content

fix: build a single engine for multiple projects using the same toolchain versions#509

Open
doorgan wants to merge 1 commit intomainfrom
doorgan/deduplicate-engine-builder
Open

fix: build a single engine for multiple projects using the same toolchain versions#509
doorgan wants to merge 1 commit intomainfrom
doorgan/deduplicate-engine-builder

Conversation

@doorgan
Copy link
Copy Markdown
Collaborator

@doorgan doorgan commented Mar 13, 2026

Fix #466

When resuming a session on Expert itself, I would regularly see issues due to multiple engine builders trying to modify the same files. This PR introduces a coordinator that keeps track of finished and in-flight builds, and ensures that:

  • An engine for an elixir+otp pair is built once during the lifetime of the Expert instance, and reused upon project restarts
  • If multiple projects using the same versions request an engine at the same time, or while that version is being built, they all wait for the same, single builder to finish instead of starting new ones
  • Additionally, ensures engines for different versions can be built concurrently

Besides fixing that issue, it also cuts down startup time for Expert by a lot, since we builds the engine once instead of thrice(forge, engine, expert), once one engine finishes building the rest are instant.

@doorgan doorgan force-pushed the doorgan/deduplicate-engine-builder branch 2 times, most recently from bd7a165 to 204b219 Compare March 13, 2026 18:36
@doorgan doorgan force-pushed the doorgan/deduplicate-engine-builder branch 2 times, most recently from a9d47a0 to cba5b02 Compare March 24, 2026 19:55
@doorgan doorgan marked this pull request as ready for review March 24, 2026 20:03
@mhanberg
Copy link
Copy Markdown
Member

@katafrakt can you give this a review when you get a chance.

Copy link
Copy Markdown
Contributor

@katafrakt katafrakt left a comment

Choose a reason for hiding this comment

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

The change looks great. I just left 2 code style comments + a doubt about Windows.

@doorgan doorgan force-pushed the doorgan/deduplicate-engine-builder branch from cba5b02 to a825253 Compare March 30, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Build the engine once for every elixir+otp combination

3 participants