Skip to content

Recompilation speedup: Put custom guards in Web.Utils.Guards

Alex Gleason requested to merge cycles-guard into develop

User.Query uses a custom guard, not_empty_string/1, which checks that a param is_binary() and isn't "".

For some reason that guard was inside AdminAPI.Search, creating compile-time cycles. not_empty_string/1 is generic and reusable, so I moved it to a new module for holding site-wide guards, Web.Utils.Guards.

Doing so gets rid of a cycle: https://www.diffchecker.com/8xepzWZE

Screenshot_from_2021-06-07_15-53-25

Also, I rewrote not_empty_string/1 using defguard (Elixir 1.6) instead of defmacro.

Edited by Alex Gleason

Merge request reports

Loading