diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2013-03-14 12:46:15 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2013-03-14 12:46:15 +0000 |
| commit | 2351c884c163400206241ea09a8a5ef232fc1416 (patch) | |
| tree | 70f24d55be83a238e009fcc7581ce9f72f54c7ad /src | |
| parent | 11ab9bf8428c49f221a5f21538ee22828a31c441 (diff) | |
| download | rabbitmq-server-git-2351c884c163400206241ea09a8a5ef232fc1416.tar.gz | |
Cache the result of the external command
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_disk_monitor.erl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rabbit_disk_monitor.erl b/src/rabbit_disk_monitor.erl index b396b2899d..3bb163a18c 100644 --- a/src/rabbit_disk_monitor.erl +++ b/src/rabbit_disk_monitor.erl @@ -31,6 +31,7 @@ -record(state, {dir, limit, + actual, timeout, timer, alarmed @@ -106,8 +107,8 @@ handle_call({set_check_interval, Timeout}, _From, State) -> {ok, cancel} = timer:cancel(State#state.timer), {reply, ok, State#state{timeout = Timeout, timer = start_timer(Timeout)}}; -handle_call(get_disk_free, _From, State = #state { dir = Dir }) -> - {reply, get_disk_free(Dir), State}; +handle_call(get_disk_free, _From, State = #state { actual = Actual }) -> + {reply, Actual, State}; handle_call(_Request, _From, State) -> {noreply, State}. @@ -156,7 +157,7 @@ internal_update(State = #state { limit = Limit, _ -> ok end, - State #state {alarmed = NewAlarmed}. + State #state {alarmed = NewAlarmed, actual = CurrentFreeBytes}. get_disk_free(Dir) -> get_disk_free(Dir, os:type()). |
