Retry three times, then bail out and return not found.
This commit is contained in:
parent
48419ce4d0
commit
c60fa22422
1 changed files with 6 additions and 3 deletions
|
@ -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)).
|
||||||
|
|
Loading…
Reference in a new issue