diff options
author | James Wheare <[email protected]> | 2012-09-25 15:23:55 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2012-10-01 11:47:56 +0200 |
commit | 79ce4791a326b15bec80e1a3870136548419a212 (patch) | |
tree | 2296a5ec233e57ae09aac3291ec49555fb3a000b /lib/mnesia/src/mnesia_tm.erl | |
parent | af9a8a011fd06ae54187bae73192c52495090933 (diff) | |
download | otp-79ce4791a326b15bec80e1a3870136548419a212.tar.gz otp-79ce4791a326b15bec80e1a3870136548419a212.tar.bz2 otp-79ce4791a326b15bec80e1a3870136548419a212.zip |
mnesia: Use chained send_after instead of send_interval
timer:send_interval behaves badly when resuming from sleep on some
platforms. For example, if I sleep for 10 minutes, and have a
send_interval running once per minute, when I resume, 10 messages
will be sent immediately, eliminating the benefit of only running
the work periodically. This is admittedly a separate bug with
send_interval, but the workaround is straightforward, and also
protects from messages piling up in the queue when the work takes
longer than the interval.
This patch fixes piled up error reports on resume from sleep:
** WARNING ** Mnesia is overloaded: {dump_log, write_threshold}
You'll still be warned if mnesia is overloaded, just not repeatedly.
Additionally, erlang:send_after is more efficient than using the
timer module equivalent [1]
[1] http://www.erlang.org/doc/efficiency_guide/commoncaveats.html#id57251
Diffstat (limited to 'lib/mnesia/src/mnesia_tm.erl')
-rw-r--r-- | lib/mnesia/src/mnesia_tm.erl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/mnesia/src/mnesia_tm.erl b/lib/mnesia/src/mnesia_tm.erl index 0af7f55c06..b5b14ac05b 100644 --- a/lib/mnesia/src/mnesia_tm.erl +++ b/lib/mnesia/src/mnesia_tm.erl @@ -103,7 +103,8 @@ init(Parent) -> end, mnesia_schema:purge_tmp_files(), - mnesia_recover:start_garb(), + mnesia_recover:next_garb(), + mnesia_recover:next_check_overload(), ?eval_debug_fun({?MODULE, init}, [{nodes, AllOthers}]), |