I've tried hard to avoid making any compromises with recompilation speedup, but this one is just a bit too difficult to avoid. It's a small compromise to get us to 0 cycles.
Using @behavior
creates a compile-time dep on that module:
@behaviour Pleroma.Web.ActivityPub.ActivityPub.Persisting
@behaviour Pleroma.Web.ActivityPub.ActivityPub.Streaming
Due to the way cycles work, if there's a compile-time dep anywhere in a runtime cycle, that cycle will become a compile-time cycle.
The cycle looks like this:
ActivityPub
--(compile)--> Streaming
--(runtime)--> Activity
--(runtime)--> ActivityPub
...loop
By changing the types in Streaming
to generic struct()
, we fix a compile-time cycle and shrink many others: https://www.diffchecker.com/NyVXs3en
To fix problem "the hard way", we would need to move all the logic out of Pleroma.Activity
into a manager module like Pleroma.ActivityManager
and let Activity
just be the struct.