Fix the format of supervisees option

This commit is contained in:
terry-xiaoyu 2019-08-05 11:38:03 +08:00
parent b5cc357207
commit f7529f4fad
1 changed files with 3 additions and 3 deletions

View File

@ -125,7 +125,7 @@ handle_info({'EXIT', Pid, Reason}, State = #state{opts = Opts, supervisees = Sup
Secs -> reconnect(Secs, State) Secs -> reconnect(Secs, State)
end; end;
false -> false ->
logger:warning("~p received unexpected exit: ~p, ~p", [?MODULE, Pid, Reason]), logger:debug("~p received unexpected exit:~0p from ~p. Supervisees: ~p", [?MODULE, Reason, Pid, SupPids]),
{noreply, State} {noreply, State}
end; end;
@ -172,7 +172,7 @@ reconnect(Secs, State = #state{client = Client, on_disconnect = Disconnect, supe
[erlang:unlink(P) || P <- SubPids, is_pid(P)], [erlang:unlink(P) || P <- SubPids, is_pid(P)],
handle_disconnect(Client, Disconnect), handle_disconnect(Client, Disconnect),
erlang:send_after(timer:seconds(Secs), self(), reconnect), erlang:send_after(timer:seconds(Secs), self(), reconnect),
{noreply, State#state{client = undefined, supervisees = []}}. {noreply, State#state{client = undefined}}.
handle_reconnect(_, undefined) -> handle_reconnect(_, undefined) ->
ok; ok;
@ -191,7 +191,7 @@ connect_internal(State) ->
{ok, Client} when is_pid(Client) -> {ok, Client} when is_pid(Client) ->
erlang:link(Client), erlang:link(Client),
{ok, State#state{client = Client, supervisees = [Client]}}; {ok, State#state{client = Client, supervisees = [Client]}};
{{ok, Client}, #{supervisees := SupPids} = _SupOpts} when is_list(SupPids) -> {ok, Client, #{supervisees := SupPids} = _SupOpts} when is_list(SupPids) ->
[erlang:link(P) || P <- SupPids], [erlang:link(P) || P <- SupPids],
{ok, State#state{client = Client, supervisees = SupPids}}; {ok, State#state{client = Client, supervisees = SupPids}};
{error, Error} -> {error, Error} ->