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 033661875e
commit 08acdbefc8

View file

@ -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}} ->
@ -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)).