Skip to content

Commit

Permalink
Retry three times, then bail out and return not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory Burd committed Sep 4, 2013
1 parent 48419ce commit c60fa22
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/async_nif.hrl
Expand Up @@ -22,7 +22,7 @@
%% -------------------------------------------------------------------

-define(ASYNC_NIF_CALL(Fun, Args),
F = fun(F) ->
F = fun(F, T) ->
R = erlang:make_ref(),
case erlang:apply(Fun, [R|Args]) of
{ok, {enqueued, PctBusy}} ->
Expand All @@ -43,9 +43,12 @@
Reply
end;
{error, eagain} ->
F(F);
case T of
3 -> not_found;
_ -> F(F, T + 1)
end;
Other ->
Other
end
end,
F(F)).
F(F, 1)).

0 comments on commit c60fa22

Please sign in to comment.