From 777909b0f54f850029aa432f421edcc56cbbbbc8 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Mon, 12 Oct 2015 15:30:37 +0900 Subject: [PATCH] TODO MARK todo comment and bugfix for machi_cr_client_test --- src/machi_flu_metadata_mgr.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/machi_flu_metadata_mgr.erl b/src/machi_flu_metadata_mgr.erl index 0ef2185..f565a97 100644 --- a/src/machi_flu_metadata_mgr.erl +++ b/src/machi_flu_metadata_mgr.erl @@ -193,7 +193,15 @@ compute_hash(Data) -> compute_worker(Hash) -> MgrCount = get_env(metadata_manager_count, ?MAX_MGRS), - Hash rem MgrCount. + (Hash rem MgrCount) + 1. + %% TODO MARK: Hrm, the intermittent failures of both of the tests + %% in machi_cr_client_test.erl were due to this func returning 0. + %% But machi_flu_metadata_mgr_sup:init() doesn't make a child with N=0. + %% + %% The remaining puzzle for me, which I'm now punting to you, sorry, + %% is why those two tests would sometimes pass, which implies to me that + %% sometimes the code path used by those tests never chooses worker 0 + %% and occasionally it does choose worker 0. get_manager_atom(FluName, Data) -> build_metadata_mgr_name(FluName, compute_worker(compute_hash(Data))).