diff options
author | Henrik Nord <[email protected]> | 2012-12-13 14:31:44 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2012-12-13 14:31:49 +0100 |
commit | 7c71176ca25514c982c652973b5d1300e4f9f1df (patch) | |
tree | 25f12bf707ecb52d615c85d18c40baed3d30e117 /lib/mnesia/src/mnesia_controller.erl | |
parent | 154517c09ad8ea98bb928e8d200d83d41c3077df (diff) | |
parent | 79ce4791a326b15bec80e1a3870136548419a212 (diff) | |
download | otp-7c71176ca25514c982c652973b5d1300e4f9f1df.tar.gz otp-7c71176ca25514c982c652973b5d1300e4f9f1df.tar.bz2 otp-7c71176ca25514c982c652973b5d1300e4f9f1df.zip |
Merge branch 'jwh/mnesia_interval_removal'
* jwh/mnesia_interval_removal:
mnesia: Use chained send_after instead of send_interval
OTP-10636
Diffstat (limited to 'lib/mnesia/src/mnesia_controller.erl')
-rw-r--r-- | lib/mnesia/src/mnesia_controller.erl | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/mnesia/src/mnesia_controller.erl b/lib/mnesia/src/mnesia_controller.erl index d488a33d67..ec67d9ec12 100644 --- a/lib/mnesia/src/mnesia_controller.erl +++ b/lib/mnesia/src/mnesia_controller.erl @@ -593,6 +593,12 @@ multicall(Nodes, Msg) -> {PatchedGood, Bad}. %% Make the replies look like rpc:multicalls.. %% rpc:multicall(Nodes, ?MODULE, call, [Msg]). +next_async_dump_log() -> + Interval = mnesia_monitor:get_env(dump_log_time_threshold), + Msg = {next_async_dump_log, time_threshold}, + Ref = erlang:send_after(Interval, self(), Msg), + Ref. + %%%---------------------------------------------------------------------- %%% Callback functions from gen_server %%%---------------------------------------------------------------------- @@ -614,9 +620,7 @@ init([Parent]) -> mnesia_lib:unset(original_nodes), mnesia_recover:connect_nodes(Diff), - Interval = mnesia_monitor:get_env(dump_log_time_threshold), - Msg = {async_dump_log, time_threshold}, - {ok, Ref} = timer:send_interval(Interval, Msg), + Ref = next_async_dump_log(), mnesia_dumper:start_regulator(), Empty = gb_trees:empty(), @@ -1121,6 +1125,11 @@ handle_sync_tabs([], _From) -> %% {stop, Reason, State} (terminate/2 is called) %%---------------------------------------------------------------------- +handle_info({next_async_dump_log, InitBy}, State) -> + async_dump_log(InitBy), + Ref = next_async_dump_log(), + noreply(State#state{dump_log_timer_ref=Ref}); + handle_info({async_dump_log, InitBy}, State) -> Worker = #dump_log{initiated_by = InitBy}, State2 = add_worker(Worker, State), |