You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2019/09/25 09:04:07 UTC

[couchdb] 02/02: feat: simplify code

This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch feat/intervals
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 56b85a521199e5c509bb5fe78eab56e58ebce069
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Wed Sep 25 11:03:38 2019 +0200

    feat: simplify code
---
 src/couch_stats/src/couch_stats_aggregator.erl | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/couch_stats/src/couch_stats_aggregator.erl b/src/couch_stats/src/couch_stats_aggregator.erl
index f3d2320..8771d4e 100644
--- a/src/couch_stats/src/couch_stats_aggregator.erl
+++ b/src/couch_stats/src/couch_stats_aggregator.erl
@@ -152,12 +152,9 @@ collect(#st{collect_timer=OldCT} = State) ->
     {ok, CT} = update_timer(collect),
     State#st{stats=Stats, collect_timer=CT}.
 
-update_timer(collect) ->
-    Interval = get_interval(collect),
-    erlang:send_after(Interval, self(), collect);
-update_timer(reload) ->
-    Interval = get_interval(reload),
-    erlang:send_after(Interval, self(), reload).
+update_timer(Type) ->
+    Interval = get_interval(Type),
+    erlang:send_after(Interval, self(), Type).
 
 get_interval(reload) -> 1000 * ?RELOAD_INTERVAL;
 get_interval(collect) -> 1000 * config:get_integer("stats", "interval", ?DEFAULT_INTERVAL).