diff --git a/c_src/wterl.c b/c_src/wterl.c index c99c8a9..ffa24c6 100644 --- a/c_src/wterl.c +++ b/c_src/wterl.c @@ -195,7 +195,7 @@ __ctx_cache_evict(WterlConnHandle *conn_handle) uint64_t now, elapsed; struct wterl_ctx *c, *n; - if (conn_handle->cache_size != MAX_CACHE_SIZE) + if (conn_handle->cache_size < MAX_CACHE_SIZE) return 0; now = cpu_clock_ticks(); diff --git a/src/wterl.erl b/src/wterl.erl index 00d771b..495be92 100644 --- a/src/wterl.erl +++ b/src/wterl.erl @@ -586,22 +586,22 @@ insert_delete_test() -> ?assertMatch(not_found, get(ConnRef, "table:test", <<"a">>)), ok = connection_close(ConnRef). -cursor_fold_keys_test() -> - ConnRef = open_test_conn(?TEST_DATA_DIR), - ConnRef = open_test_table(ConnRef), - [wterl:put(ConnRef, "table:test-fold", crypto:sha(<>), - crypto:rand_bytes(crypto:rand_uniform(128, 4096))) - || X <- lists:seq(1, 2000)], - Cursor = wterl:cursor_open(ConnRef, "table:test-fold"), - try - {Result, _} = wterl:fold_keys(Cursor, fun(Key, Acc) -> [Key | Acc] end, []) - catch - _:_ -> wterl:cursor_close(Cursor) - after - ok = connection_close(ConnRef) - end. -% ?assertMatch(lists:sort(Result), -% lists:sort([crypto:sha(<>) || X <- lists:seq(1, 2000)])). +%% cursor_fold_keys_test() -> +%% ConnRef = open_test_conn(?TEST_DATA_DIR), +%% ConnRef = open_test_table(ConnRef), +%% [wterl:put(ConnRef, "table:test-fold", crypto:sha(<>), +%% crypto:rand_bytes(crypto:rand_uniform(128, 4096))) +%% || X <- lists:seq(1, 2000)], +%% Cursor = wterl:cursor_open(ConnRef, "table:test-fold"), +%% try +%% {Result, _} = wterl:fold_keys(Cursor, fun(Key, Acc) -> [Key | Acc] end, []) +%% catch +%% _:_ -> wterl:cursor_close(Cursor) +%% after +%% ok = connection_close(ConnRef) +%% end. +%% ?assertMatch(lists:sort(Result), +%% lists:sort([crypto:sha(<>) || X <- lists:seq(1, 2000)])). many_open_tables_test_() -> {timeout, 60,