From 0278d7254be00e98ab593ff4ad1e0d0691cfa903 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 20 Aug 2015 23:04:27 +0900 Subject: [PATCH] Add A29 state for shouting circuit breaker for long long loops --- src/machi_chain_manager1.erl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index b615261..5c81fef 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -1113,12 +1113,23 @@ react_to_env_A20(Retries, #ch_mgr{name=MyName}=S) -> true -> exit({badbad, UnanimousTag}) end, - react_to_env_A30(Retries, P_latest, LatestUnanimousP, ReadExtra, S2). + react_to_env_A29(Retries, P_latest, LatestUnanimousP, ReadExtra, S2). + +react_to_env_A29(Retries, P_latest, LatestUnanimousP, ReadExtra, S) -> + XX = length(get(react)), + if XX > 3000 -> + io:format(user, "CONFIRM by mgr ~p max len XX ~p, break\n", + [S#ch_mgr.name, XX]), + react_to_env_A50(P_latest, [], S); + true -> + react_to_env_A30(Retries, P_latest, LatestUnanimousP, ReadExtra, S) + end. react_to_env_A30(Retries, P_latest, LatestUnanimousP, _ReadExtra, #ch_mgr{name=MyName, proj=P_current, consistency_mode=CMode, flap_limit=FlapLimit} = S) -> ?REACT(a30), + %% case length(get(react)) of XX when XX > 500 -> io:format(user, "A30 ~w! ~w: ~P\n", [MyName, XX, get(react), 300]), timer:sleep(500); _ -> ok end, {P_newprop1, S2, Up} = calc_projection(S, MyName), ?REACT({a30, ?LINE, [{current, machi_projection:make_summary(S#ch_mgr.proj)}]}), ?REACT({a30, ?LINE, [{newprop1, machi_projection:make_summary(P_newprop1)}]}),