Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement mix listener to respect concurrent compilations #5955

Merged
merged 3 commits into from
Oct 22, 2024

Conversation

jonatanklosko
Copy link
Contributor

@jonatanklosko jonatanklosko commented Oct 21, 2024

This improves the code reloader to better handle concurrent compilations using Mix listeners API coming in Elixir v1.18.

The code reloader already handles concurrent compilation by checking the Elixir compiler manifest. If the manifest appears stale, we prune all modules from the given application. However, always pruning all modules can be expensive if the number of loaded modules is large.

This PR introduces a Mix listener that listens to concurrent compilations and keeps track of the changed modules. Then, before compiling, we prune only the modules that actually changed.

On Elixir < 1.18 we fall back to the current approach. On Elixir >= 1.18 we warn if the listener is not configured (and also use the fallback).

cc @josevalim

@josevalim josevalim merged commit 65d2507 into phoenixframework:main Oct 22, 2024
7 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@jonatanklosko jonatanklosko deleted the jk-mix-listener branch October 22, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants