fix: api total accumulate ignore `undefined` by down nodes result

This commit is contained in:
JimMoen 2023-08-11 11:27:55 +08:00
parent 65aee8870b
commit 060074e04a
No known key found for this signature in database
GPG Key ID: 87A520B4F76BA86D
5 changed files with 9 additions and 5 deletions

View File

@ -1,7 +1,7 @@
%% -*- mode: erlang -*-
{application, emqx_authn, [
{description, "EMQX Authentication"},
{vsn, "0.1.24"},
{vsn, "0.1.25"},
{modules, []},
{registered, [emqx_authn_sup, emqx_authn_registry]},
{applications, [

View File

@ -3,7 +3,7 @@
{id, "emqx_machine"},
{description, "The EMQX Machine"},
% strict semver, bump manually!
{vsn, "0.2.11"},
{vsn, "0.2.12"},
{modules, []},
{registered, []},
{applications, [kernel, stdlib, emqx_ctl]},

View File

@ -2,7 +2,7 @@
{application, emqx_management, [
{description, "EMQX Management API and CLI"},
% strict semver, bump manually!
{vsn, "5.0.27"},
{vsn, "5.0.28"},
{modules, []},
{registered, [emqx_management_sup]},
{applications, [kernel, stdlib, emqx_plugins, minirest, emqx, emqx_ctl, emqx_bridge_http]},

View File

@ -460,7 +460,11 @@ finalize_query(Result = #{overflow := Overflow}, QueryState = #{complete := Comp
maybe_accumulate_totals(Result#{hasnext => HasNext}, QueryState).
maybe_accumulate_totals(Result, #{total := TotalAcc}) ->
QueryTotal = maps:fold(fun(_Node, T, N) -> N + T end, 0, TotalAcc),
AccFun = fun
(_Node, NodeTotal, AccIn) when is_number(NodeTotal) -> AccIn + NodeTotal;
(_Node, _, AccIn) -> AccIn
end,
QueryTotal = maps:fold(AccFun, 0, TotalAcc),
Result#{total => QueryTotal};
maybe_accumulate_totals(Result, _QueryState) ->
Result.

View File

@ -2,7 +2,7 @@
{application, emqx_retainer, [
{description, "EMQX Retainer"},
% strict semver, bump manually!
{vsn, "5.0.16"},
{vsn, "5.0.17"},
{modules, []},
{registered, [emqx_retainer_sup]},
{applications, [kernel, stdlib, emqx, emqx_ctl]},