fix(emqx_mod_sup): Dialyzer warning
All the callers of start_child API are discarding the return value.
This commit is contained in:
parent
f3d973689b
commit
5793ef6640
|
@ -40,11 +40,13 @@
|
||||||
start_link() ->
|
start_link() ->
|
||||||
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
||||||
|
|
||||||
|
-spec start_child(supervisor:child_spec()) -> ok.
|
||||||
start_child(ChildSpec) when is_map(ChildSpec) ->
|
start_child(ChildSpec) when is_map(ChildSpec) ->
|
||||||
supervisor:start_child(?MODULE, ChildSpec).
|
assert_started(supervisor:start_child(?MODULE, ChildSpec)).
|
||||||
|
|
||||||
|
-spec start_child(atom(), atom()) -> ok.
|
||||||
start_child(Mod, Type) when is_atom(Mod) andalso is_atom(Type) ->
|
start_child(Mod, Type) when is_atom(Mod) andalso is_atom(Type) ->
|
||||||
supervisor:start_child(?MODULE, ?CHILD(Mod, Type)).
|
assert_started(supervisor:start_child(?MODULE, ?CHILD(Mod, Type))).
|
||||||
|
|
||||||
-spec(stop_child(any()) -> ok | {error, term()}).
|
-spec(stop_child(any()) -> ok | {error, term()}).
|
||||||
stop_child(ChildId) ->
|
stop_child(ChildId) ->
|
||||||
|
@ -61,3 +63,12 @@ init([]) ->
|
||||||
ok = emqx_tables:new(emqx_modules, [set, public, {write_concurrency, true}]),
|
ok = emqx_tables:new(emqx_modules, [set, public, {write_concurrency, true}]),
|
||||||
{ok, {{one_for_one, 10, 100}, []}}.
|
{ok, {{one_for_one, 10, 100}, []}}.
|
||||||
|
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
%% Internal functions
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
|
assert_started({ok, _Pid}) -> ok;
|
||||||
|
assert_started({ok, _Pid, _Info}) -> ok;
|
||||||
|
assert_started({error, {already_tarted, _Pid}}) -> ok;
|
||||||
|
assert_started({error, Reason}) -> erlang:error(Reason).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue