Skip to content

Recompilation speedup: create Dynamic client for ReverseProxy

Alex Gleason requested to merge cycles-reverse-proxy into develop

#2651 (closed)

ReverseProxy can have a configurable HTTP client. The choices are Hackney and Tesla.

Those clients use @behaviour Pleroma.ReverseProxy.Client. However, Pleroma.ReverseProxy.Client also contains functions, resulting in compile-time cycles.

After thinking about this harder, I realized the code in ReverseProxy.Client is a Client itself. It dynamically chooses either Hackney or Tesla based on the user's config.

In light of this, I moved the code into ReverseProxy.Client.Dynamic. Now ReverseProxy.Client is strictly a behaviour with no other deps. It removes a cycle and reduces 3 others: https://www.diffchecker.com/lA3gMLyO

Screenshot_from_2021-06-02_16-17-05

I'm pretty happy with this one because I think it's a code quality improvement in addition to speeding up recompilation.

Merge request reports