[erlang-patches] mnesia: Use chained send_after instead of send_interval

Henrik Nord henrik@REDACTED
Mon Oct 1 13:16:50 CEST 2012


I have included your patch in 'master-pu'

Thank you for your contribution!

On 09/26/2012 04:27 PM, James Wheare wrote:
> Fetch command:
>   git fetch git://github.com/jwheare/otp.git mnesia_interval_removal
>
> Compare: https://github.com/jwheare/otp/compare/mnesia_interval_removal
> Patch: https://github.com/jwheare/otp/compare/mnesia_interval_removal.patch
>
>   mnesia_controller.erl |   15 +++++++++--
>   mnesia_recover.erl    |   66 ++++++++++++++++++++++++++++----------------------
>   mnesia_tm.erl         |    3 +-
>   1 commit, 3 files changed, 51 insertions(+), 33 deletions(-)
>
> ---
>
> 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
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches

-- 
/Henrik Nord Erlang/OTP




More information about the erlang-patches mailing list