Skip to content

Commit

Permalink
Hack try/catch to ignore re-creation of table errors
Browse files Browse the repository at this point in the history
  • Loading branch information
slfritchie committed Jan 28, 2015
1 parent 3fd1635 commit 80e7971
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/basho_bench_valgen.erl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ init_source(1, undefined) ->
SourceSz = basho_bench_config:get(?VAL_GEN_SRC_SIZE, 96*1048576),
?INFO("Random source: calling crypto:rand_bytes(~w) (override with the '~w' config option\n", [SourceSz, ?VAL_GEN_SRC_SIZE]),
Bytes = crypto:rand_bytes(SourceSz),
?TAB = ets:new(?TAB, [public, named_table]),
true = ets:insert(?TAB, {x, Bytes}),
try
?TAB = ets:new(?TAB, [public, named_table]),
true = ets:insert(?TAB, {x, Bytes})
catch _:_ -> rerunning_id_1_init_source_table_already_exists
end,
?INFO("Random source: finished crypto:rand_bytes(~w)\n", [SourceSz]),
{?VAL_GEN_SRC_SIZE, SourceSz, Bytes};
init_source(_Id, undefined) ->
Expand Down

0 comments on commit 80e7971

Please sign in to comment.