diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-11-12 15:59:28 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-11-12 15:59:28 +0000 |
commit | 053d4728cf24d979a397cb5215954049ec4ac496 (patch) | |
tree | faf2a37e7b84173172614c53b9c9d3fe665804f7 | |
parent | a6f80fe5cab43561afcf8a9853e3111eaa5664bb (diff) | |
download | rabbitmq-server-053d4728cf24d979a397cb5215954049ec4ac496.tar.gz |
cast not call.
-rw-r--r-- | src/background_gc.erl | 14 | ||||
-rw-r--r-- | src/rabbit_alarm.erl | 5 |
2 files changed, 9 insertions, 10 deletions
diff --git a/src/background_gc.erl b/src/background_gc.erl index 64b86b18..34741eba 100644 --- a/src/background_gc.erl +++ b/src/background_gc.erl @@ -18,7 +18,7 @@ -behaviour(gen_server2). --export([start_link/0, gc_all/0]). +-export([start_link/0, run/0]). -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]). @@ -38,8 +38,8 @@ start_link() -> gen_server2:start_link({local, ?MODULE}, ?MODULE, [], [{timeout, infinity}]). -gc_all() -> - gen_server2:call(?MODULE, gc_all, infinity). +run() -> + gen_server2:cast(?MODULE, gc_all). %%---------------------------------------------------------------------------- @@ -47,13 +47,13 @@ init([]) -> {ok, run_gc(#state{last_interval = ?IDEAL_INTERVAL}), hibernate, {backoff, ?HIBERNATE_AFTER_MIN, ?HIBERNATE_AFTER_MIN, ?DESIRED_HIBERNATE}}. -handle_call(gc_all, _From, State) -> - do_gc(), - {reply, ok, State, hibernate}; - handle_call(Msg, _From, State) -> {stop, {unexpected_call, Msg}, State}. +handle_cast(gc_all, State) -> + do_gc(), + {noreply, State, hibernate}; + handle_cast(Msg, State) -> {stop, {unexpected_cast, Msg}, State}. diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl index e5f8a1c4..d7d4d82a 100644 --- a/src/rabbit_alarm.erl +++ b/src/rabbit_alarm.erl @@ -57,9 +57,8 @@ start() -> rabbit_sup:start_restartable_child( vm_memory_monitor, [MemoryWatermark, fun (Alarm) -> - R = set_alarm(Alarm), - background_gc:gc_all(), - R + background_gc:run(), + set_alarm(Alarm) end, fun clear_alarm/1]), {ok, DiskLimit} = application:get_env(disk_free_limit), |