Created
June 6, 2011 14:47
-
-
Save gordyt/1010384 to your computer and use it in GitHub Desktop.
riak_search_op_utils.erl - update 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it_op_collector_loop(Parent, Ref, []) -> | |
receive | |
{results, Results, Ref} -> | |
%%error_logger:error_msg("it_op_collector_loop/3: results Parent=~p, Ref=~p~n", [Parent, Ref]), | |
it_op_collector_loop(Parent, Ref, Results); | |
{disconnect, Ref} -> | |
%%error_logger:error_msg("it_op_collector_loop/3: disconnect Parent=~p, Ref=~p~n", [Parent, Ref]), | |
it_op_collector_loop(Parent, Ref, eof); | |
{'EXIT', Parent, _} -> | |
error_logger:error_msg("it_op_collector_loop/3: exit (1) Parent=~p, Ref=~p~n", [Parent, Ref]), | |
stop | |
end; | |
it_op_collector_loop(Parent, Ref, [Result|Results]) -> | |
receive | |
{get_result, OutputPid, OutputRef} -> | |
%%error_logger:error_msg("it_op_collector_loop/3: get_result OutputPid=~p, OutputRef=~p, Parent=~p, Ref=~p~n", [OutputPid, OutputRef, Parent, Ref]), | |
OutputPid!{result, Result, OutputRef}, | |
it_op_collector_loop(Parent, Ref, Results); | |
{'EXIT', Parent, _} -> | |
error_logger:error_msg("it_op_collector_loop/3: exit (2) Parent=~p, Ref=~p~n", [Parent, Ref]), | |
stop | |
after 5000 -> | |
error_logger:error_msg("it_op_collector_loop/3: timeout, dumping results - Parent=~p, Ref=~p~n", [Parent, Ref]), | |
it_op_collector_loop(Parent, Ref, []) | |
end; | |
it_op_collector_loop(Parent, Ref, eof) -> | |
%%error_logger:error_msg("it_op_collector_loop/3: EOF ~p~n", [erlang:process_info(self(), [messages])]), | |
receive | |
{get_result, OutputPid, OutputRef} -> | |
%%error_logger:error_msg("it_op_collector_loop/3: get_result eof OutputPid=~p, OutputRef=~p, Parent=~p, Ref=~p~n", [OutputPid, OutputRef, Parent, Ref]), | |
OutputPid!{result, eof, OutputRef}; | |
{'EXIT', Parent, _} -> | |
error_logger:error_msg("it_op_collector_loop/3: exit (3) Parent=~p, Ref=~p~n", [Parent, Ref]), | |
stop | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment