From 6b84cd6e6a07753e35ff6e347ad78fb4e4f6490f Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Sat, 29 Aug 2015 18:30:53 +0900 Subject: [PATCH] Reduce poll sleep time when running with partition simulator --- src/machi_chain_manager1.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index 8aa7434..be72cd6 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -2745,8 +2745,14 @@ poll_private_proj_is_upi_unanimous(#ch_mgr{consistency_mode=cp_mode, poll_private_proj_is_upi_unanimous_sleep(Count, S) when Count > 2 -> S; -poll_private_proj_is_upi_unanimous_sleep(Count, S) -> - timer:sleep((Count * Count) * 50), +poll_private_proj_is_upi_unanimous_sleep(Count, #ch_mgr{runenv=RunEnv}=S) -> + Denom = case proplists:get_value(use_partition_simulator, RunEnv, false) of + true -> + 20; + _ -> + 1 + end, + timer:sleep(((Count * Count) * 50) div Denom), case poll_private_proj_is_upi_unanimous3(S) of #ch_mgr{proj_unanimous=false} = S2 -> poll_private_proj_is_upi_unanimous_sleep(Count + 1, S2);