Skip to content

Commit

Permalink
Merge branch 'bwf-riak-pipe-48' into 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
beerriot committed Aug 15, 2012
2 parents 7419c0c + f1e938a commit ff7acb8
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
22 changes: 19 additions & 3 deletions src/riak_kv_pipe_index.erl
Expand Up @@ -147,7 +147,23 @@ queue_existing_pipe(Pipe, Bucket, Query, Timeout) ->
[LKP, {Bucket, Query}, NVal]]),

%% wait for cover to hit everything
erlang:link(Sender),
{RealTO, TOReason} =
try erlang:link(Sender) of
true ->
%% Sender was alive - wait as expected
{Timeout, timeout}
catch error:noproc ->
%% Sender finished early; it's always spawned locally,
%% so we'll get a noproc exit, instead of an exit signal

%% messages had better already be in our mailbox,
%% don't wait any extra time for them
{0,
%% we'll have no idea what its failure was, unless it
%% sent us an error message
index_coverage_failure}
end,

receive
{ReqId, done} ->
%% this eoi will flow into the other pipe
Expand All @@ -157,8 +173,8 @@ queue_existing_pipe(Pipe, Bucket, Query, Timeout) ->
%% this destroy should not harm the other pipe
riak_pipe:destroy(LKP),
Error
after Timeout ->
after RealTO ->
%% this destroy should not harm the other pipe
riak_pipe:destroy(LKP),
{error, timeout}
{error, TOReason}
end.
22 changes: 19 additions & 3 deletions src/riak_kv_pipe_listkeys.erl
Expand Up @@ -156,7 +156,23 @@ queue_existing_pipe(Pipe, Bucket, Timeout) ->
[LKP, Bucket, NVal]]),

%% wait for cover to hit everything
erlang:link(Sender),
{RealTO, TOReason} =
try erlang:link(Sender) of
true ->
%% Sender was alive - wait as expected
{Timeout, timeout}
catch error:noproc ->
%% Sender finished early; it's always spawned locally,
%% so we'll get a noproc exit, instead of an exit signal

%% messages had better already be in our mailbox,
%% don't wait any extra time for them
{0,
%% we'll have no idea what its failure was, unless it
%% sent us an error message
listkeys_coverage_failure}
end,

receive
{ReqId, done} ->
%% this eoi will flow into the other pipe
Expand All @@ -166,8 +182,8 @@ queue_existing_pipe(Pipe, Bucket, Timeout) ->
%% this destroy should not harm the other pipe
riak_pipe:destroy(LKP),
Error
after Timeout ->
after RealTO ->
%% this destroy should not harm the other pipe
riak_pipe:destroy(LKP),
{error, timeout}
{error, TOReason}
end.

0 comments on commit ff7acb8

Please sign in to comment.