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

Remove deps cached only when deps in mix file changed #345

Merged
merged 2 commits into from
Aug 23, 2020

Conversation

wingyplus
Copy link
Contributor

Remove deps cached every build can cause deps cached disappear in :ets.
Fixes by move calling Mix.Project.clear_deps_cache/0 only when deps in
mix.exs was change.

Fixes #235

Copy link
Member

@axelson axelson left a comment

Choose a reason for hiding this comment

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

Nice investigative work in #235 (comment) !

At first I wasn't sure about removing the prev_deps = cached_deps() line, but according to the docs Mix.Dep.load_on_environment doesn't change the cache so I think this change is good.

@lukaszsamson does this look good to you as well?

Mix.Dep.load_on_environment([]) != prev_deps,
do: fetch_deps()
Mix.Dep.load_on_environment([]) != cached_deps() do
:ok = Mix.Project.clear_deps_cache()
Copy link
Member

Choose a reason for hiding this comment

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

Can we add an explanatory comment about why this needs to be within the if statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@axelson NOTE comment added.

@lukaszsamson
Copy link
Collaborator

It looks reasonable but TBH I don't know this code very well

@wingyplus
Copy link
Contributor Author

@axelson @lukaszsamson To be honest, I don't understand the reason why we need to clear deps cache every time before fetching deps. :D

@wingyplus
Copy link
Contributor Author

wingyplus commented Aug 17, 2020

It's seems test was failing with debugger. I'm not sure why.

@axelson
Copy link
Member

axelson commented Aug 20, 2020

@wingyplus the test output (some of that debugger issue) was improved in #347 and if I can clean up #352 the test suite can become green again. So we don't need to worry about it for this PR. I plan to do a bit more testing on this and get it merged soon, hopefully this weekend, but if I take longer feel free to ping me.

@wingyplus
Copy link
Contributor Author

@axelson That's ok. What can I help?

Remove deps cached every build can cause deps cached disappear in :ets.
Fixes by move calling Mix.Project.clear_deps_cache/0 only when deps in
mix.exs was change.

Fixes elixir-lsp#235
@wingyplus
Copy link
Contributor Author

Test passed. 🎉

@wingyplus
Copy link
Contributor Author

@axelson I see an error about debugger in the CI https://travis-ci.org/github/elixir-lsp/elixir-ls/jobs/720334814#L261. Is it intention?

@lukaszsamson
Copy link
Collaborator

Yes, it’s intentional. The log message should be captured though.

@wingyplus
Copy link
Contributor Author

@lukaszsamson noted. Thanks

@axelson
Copy link
Member

axelson commented Aug 23, 2020

Thanks for rebasing! Merging now.

@axelson axelson merged commit 47eeed5 into elixir-lsp:master Aug 23, 2020
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.

Formatting does not work with phoenix and neovim (with vim-lsp)
4 participants