Aside:
What is that rationale for this structure?
dumper: %{
save_failed_request: fn url ->
send(test, {:dumper, :save_failed_request, [url]})
{:ok, :saved}
end
},
metrics: %{
inc: fn id ->
send(test, {:metrics, :inc, [id]})
{:ok, 1}
end
}
It seems a bit JavaScript-y/Object-y. If these callbacks only exist for test monitoring purposes, it should be possible to unify them into one single function using pattern matching and putting the arguments into a keyword list. (Then it should be possible to wrap it in a macro to remove the function calls from production code (similar to :compile_time_purge_matching ) - though I’ve never done it).






















