Skip to content

Fix InstanceView recompilation issue

Alex Gleason requested to merge instance-view-recompilation into develop

Related: #2651 (closed)

➜  soapbox git:(recompilation) ✗ mix compile
Compiling 174 files (.ex)
Compiling lib/pleroma/web/router.ex (it's taking more than 10s)
➜  soapbox git:(recompilation) ✗ touch lib/pleroma/web/mastodon_api/views/instance_view.ex
➜  soapbox git:(recompilation) ✗ mix compile
Compiling 1 file (.ex)

It seems the root cause of the problem is when a view or controller calls a function from another view.

I think this is related to the use Pleroma.Web, :view at the top of each view.

Whenever two views need to share functions, we can avoid crazy recompilation times by creating a third, separate module both views call from instead of calling the other view directly.

In this case, NodeinfoController was calling functions from InstanceView. I moved those functions to lib/pleroma/web/nodeinfo/nodeinfo.ex which is NOT a view, and it fixed it.

I still don't 100% get it, and I wonder if we could modify Pleroma.Web to fix this problem for all views, or if it's in inherent problem due to the fact use calls a macro.

Edited by Alex Gleason

Merge request reports