Retry three times, then bail out and return not found.

This commit is contained in:
Gregory Burd 2013-09-04 13:11:02 -04:00
parent 48419ce4d0
commit c60fa22422

View file

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