From 4767b41eb7f0b4efc9af7f81c1cbb3a95c0195df Mon Sep 17 00:00:00 2001 From: lafirest Date: Sun, 21 Nov 2021 18:55:43 +0800 Subject: [PATCH] fix(emqx_st_statistics): fix initial value error (#6224) * fix(emqx_st_statistics): fix initial value error --- .../src/emqx_st_statistics/emqx_st_statistics.erl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/emqx_plugin_libs/src/emqx_st_statistics/emqx_st_statistics.erl b/apps/emqx_plugin_libs/src/emqx_st_statistics/emqx_st_statistics.erl index f22aec41c..668cb3926 100644 --- a/apps/emqx_plugin_libs/src/emqx_st_statistics/emqx_st_statistics.erl +++ b/apps/emqx_plugin_libs/src/emqx_st_statistics/emqx_st_statistics.erl @@ -56,8 +56,8 @@ }. -record(slow_log, { topic :: emqx_types:topic() - , count :: pos_integer() - , elapsed :: pos_integer() + , count :: integer() %% 0 will be used in initial value + , elapsed :: integer() }). -type message() :: #message{}. @@ -233,8 +233,8 @@ update_log(#message{topic = Topic}, Elapsed) -> Topic, [{#slow_log.count, 1}, {#slow_log.elapsed, Elapsed}], #slow_log{topic = Topic, - count = 1, - elapsed = Elapsed}), + count = 0, + elapsed = 0}), ok. -spec do_notification(state()) -> true.