Seed randomnes at Actor startup

This commit is contained in:
martinsumner 2017-03-06 21:35:02 +00:00
parent 32cdf26ffb
commit 9ad6969b0d
4 changed files with 9 additions and 5 deletions

View file

@ -358,6 +358,8 @@ book_destroy(Pid) ->
%%%============================================================================
init([Opts]) ->
SW = os:timestamp(),
random:seed(erlang:phash2(self()), element(2, SW), element(3, SW)),
case get_opt(snapshot_bookie, Opts) of
undefined ->
% Start from file not snapshot
@ -635,7 +637,7 @@ snapshot_store(LedgerCache0, Penciller, Inker, SnapType, Query) ->
snapshot_query = Query,
bookies_mem = BookiesMem},
{ok, LedgerSnapshot} = leveled_penciller:pcl_start(PCLopts),
leveled_log:log_randomtimer("B0004", [cache_size(LedgerCache)], SW, 0.1),
leveled_log:log_randomtimer("B0004", [cache_size(LedgerCache)], SW, 0.02),
case SnapType of
store ->
InkerOpts = #inker_options{start_snapshot=true,