Skip to content
Permalink
Browse files
Fix flaky limits test.
 In the limits test we check statistics with ets:info right after
 eviction. Sometimes ets:info does not update immediately.

 On first failure, delay for 1ms, then try again.
  • Loading branch information
nickva committed Oct 7, 2015
1 parent 0912804 commit c05488c8b1d7ec1c3554a828e0c9bf2888932ed6
Showing 1 changed file with 9 additions and 1 deletion.
@@ -286,7 +286,15 @@ insert_kvs(_, _, 0, _) ->
insert_kvs(Info, LRU, Count, Limit) ->
ets_lru:insert(LRU, Count, 1.5234),
case ets:info(lru_objects, Info) > Limit of
true -> erlang:error(exceeded_limit);
true ->
% Retry again as eviction statistics
% returned by ets:info() can be delayed.
timer:sleep(1),
case ets:info(lru_objects, Info) > Limit of
true ->
erlang:error(exceeded_limit);
false -> true
end;
false -> true
end,
insert_kvs(Info, LRU, Count - 1, Limit).

0 comments on commit c05488c

Please sign in to comment.