Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Work around OTP applications which do not respond #88

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions apps/epl_st/src/epl_st.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

-behaviour(gen_server).

-define(LIVENESS_TIMEOUT, 1000).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rename this to something more meaningful, maybe TOP_SUP_RESP_TIMEOUT?


%% API
-export([start_link/0,
subscribe/0,
Expand Down Expand Up @@ -101,8 +103,13 @@ generate_sup_tree(undefined) ->
#{};
generate_sup_tree(MasterPid) ->
{SupPid, _SupName} = command(fun application_master:get_child/1, [MasterPid]),
Children = command(fun supervisor:which_children/1, [SupPid]),
sup_node(SupPid, generate_children(Children)).
case catch sys:get_status(SupPid, ?LIVENESS_TIMEOUT) of
{'EXIT', {timeout, _}} ->
#{};
_ ->
Children = command(fun supervisor:which_children/1, [SupPid]),
sup_node(SupPid, generate_children(Children))
end.

generate_children(Children) ->
lists:filtermap(
Expand Down