From f433e84fab2e8ac210b996d264c120d4561b5d0f Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 25 Feb 2016 17:52:40 +0900 Subject: [PATCH] Add 'stability_time' env var for repair --- src/machi_chain_manager1.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index 15b82ab..66b0163 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -2569,12 +2569,13 @@ perhaps_start_repair(#ch_mgr{name=MyName, %% RepairOpts = [{repair_mode, check}, verbose], RepairFun = fun() -> do_repair(S, RepairOpts, CMode) end, LastUPI = lists:last(UPI), + StabilityTime = application:get_env(machi, stability_time, ?REPAIR_START_STABILITY_TIME), IgnoreStabilityTime_p = proplists:get_value(ignore_stability_time, S#ch_mgr.opts, false), case timer:now_diff(os:timestamp(), Start) div 1000000 of N when MyName == LastUPI andalso (IgnoreStabilityTime_p orelse - N >= ?REPAIR_START_STABILITY_TIME) -> + N >= StabilityTime) -> {WorkerPid, _Ref} = spawn_monitor(RepairFun), S#ch_mgr{repair_worker=WorkerPid, repair_start=os:timestamp(),