Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ExMachina.start/2: return a supervisor from Application callback (#434)
We're actually returning the PID for an Agent rather than a supervisor. In addition to being against the erlang callback spec: The function is to return {ok,Pid} or {ok,Pid,State}, where Pid is the pid of the top supervisor and State is any term. If omitted, State defaults to []. If the application is stopped later, State is passed to Module:prep_stop/1. Some tools like phoenix live dashboard will send the application supervisor supervisor-y messages and end up crashing the root application tree. ** (FunctionClauseError) no function clause matching in Agent.Server.handle_call/3 (elixir 1.14.5) lib/agent/server.ex:11: Agent.Server.handle_call(:which_children, {#PID<0.22073.22>, #Reference<0.3953567925.3593732098.137638>}, %{}) (stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4 (stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6 (stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3 Last message (from #PID<0.22073.22>): :which_children This change makes ExMachina return a supervisor with a single child - the ExMachina.Sequence. Have also moved to `use Agent` to get the child_spec/1 for free in ExMachina.Sequence. This has been tested per the tool versions file (1.7.4 + otp 21).
- Loading branch information