Anonymous avatar Anonymous committed 4e4f09a

Turning off rereduce

Comments (0)

Files changed (1)

src/luke_phase.erl

                 modstate,
                 converge=false,
                 accumulate=false,
-                rereduce=false,
                 lead_partner,
                 partners,
                 next_phases,
         {ok, ModState} ->
             Accumulate = lists:member(accumulate, Behaviors),
             Converge = lists:member(converge, Behaviors),
-            Rereduce = proplists:get_value(rereduce, Behaviors, false),
             {ok, executing, #state{id=Id, mod=PhaseMod, modstate=ModState, next_phases=NextPhases,
-                                   flow=Flow, rereduce=Rereduce, accumulate=Accumulate, converge=Converge,
-                                   flow_timeout=Timeout}};
+                                   flow=Flow, accumulate=Accumulate, converge=Converge, flow_timeout=Timeout}};
         {stop, Reason} ->
             {stop, Reason}
     end.
 handle_callback(_Type, BadValue, _State) ->
   throw({error, {bad_return, BadValue}}).
 
-route_output(Output, #state{id=Id, converge=true, rereduce=Rereduce, accumulate=Accumulate,
-                            flow=Flow, lead_partner=Lead, next_phases=Next}=State) when is_pid(Lead) ->
-    case Rereduce of
-        false ->
-            case Accumulate of
-                true ->
-                    luke_phases:send_flow_results(Flow, Id, Output);
-                false -> ok
-            end,
-            RotatedNext = propagate_inputs(Next, Output),
-            State#state{next_phases=RotatedNext};
-        true ->
-            luke_phases:send_inputs(Lead, Output),
-            State
-    end;
+%% Route output to lead when converging
+%% Accumulation is ignored for non-leads of converging phases
+%% since all accumulation is performed in the lead process
+route_output(Output, #state{converge=true, lead_partner=Lead}=State) when is_pid(Lead) ->
+    propagate_inputs([Lead], Output),
+    State;
+
+%% Send output to flow for accumulation and propagate as inputs
+%% to the next phase. Accumulation is only true for the lead
+%% process of a converging phase
 route_output(Output, #state{id=Id, converge=true, accumulate=Accumulate, lead_partner=undefined,
                             flow=Flow, next_phases=Next}=State) ->
     if
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.