Skip to content

Commit

Permalink
Refactor try/catch in riak_kv_map_phase:handle_not_found_reply to be
Browse files Browse the repository at this point in the history
more readable.
  • Loading branch information
kellymclaughlin committed May 19, 2011
1 parent 21b79ee commit 0d9d92a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/riak_kv_map_phase.erl
Expand Up @@ -249,13 +249,13 @@ handle_not_found_reply(VNode, BKey, Executor, #state{fsms=FSMs, mapper_data=Mapp
%% The call to plan_map will call exit with reason
%% exhausted_preflist if all the preference list
%% entries have been checked.
try
%% Create a new map plan using a different preflist entry
ClaimLists = riak_kv_mapred_planner:plan_map(NewKeys),
FSMs1 = update_counter(Executor, FSMs),
{NewFSMs, _ClaimLists1, FsmKeys} = schedule_input(NewKeys, ClaimLists, QTerm, FSMs1, State),
MapperData1 = lists:keydelete(Executor, 1, MapperData ++ FsmKeys),
maybe_done(State#state{mapper_data=MapperData1, fsms=NewFSMs})
try riak_kv_mapred_planner:plan_map(NewKeys) of
ClaimLists ->
%% Create a new map plan using a different preflist entry
FSMs1 = update_counter(Executor, FSMs),
{NewFSMs, _ClaimLists1, FsmKeys} = schedule_input(NewKeys, ClaimLists, QTerm, FSMs1, State),
MapperData1 = lists:keydelete(Executor, 1, MapperData ++ FsmKeys),
maybe_done(State#state{mapper_data=MapperData1, fsms=NewFSMs})
catch
exit:exhausted_preflist ->
%% At this point the preflist has been exhausted
Expand Down

0 comments on commit 0d9d92a

Please sign in to comment.