From a5558a23049c04b58e526f8e6574267e803a4527 Mon Sep 17 00:00:00 2001 From: Rick Payne Date: Sat, 4 Nov 2017 16:08:22 +1300 Subject: [PATCH] Work around OTP applications which do not respond --- apps/epl_st/src/epl_st.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/epl_st/src/epl_st.erl b/apps/epl_st/src/epl_st.erl index 53fa81b..55730c8 100644 --- a/apps/epl_st/src/epl_st.erl +++ b/apps/epl_st/src/epl_st.erl @@ -9,6 +9,8 @@ -behaviour(gen_server). +-define(LIVENESS_TIMEOUT, 1000). + %% API -export([start_link/0, subscribe/0, @@ -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(