fix(gateway): sum the cluster connection data
This commit is contained in:
parent
db9cb6c4a0
commit
f20f05161f
|
@ -116,11 +116,13 @@ gateways(Status) ->
|
||||||
],
|
],
|
||||||
GwInfo0
|
GwInfo0
|
||||||
),
|
),
|
||||||
|
NodeStatus = cluster_gateway_status(GwName),
|
||||||
|
{MaxCons, CurrCons} = sum_cluster_connections(NodeStatus),
|
||||||
GwInfo1#{
|
GwInfo1#{
|
||||||
max_connections => max_connections_count(Config),
|
max_connections => MaxCons,
|
||||||
current_connections => current_connections_count(GwName),
|
current_connections => CurrCons,
|
||||||
listeners => get_listeners_status(GwName, Config),
|
listeners => get_listeners_status(GwName, Config),
|
||||||
node_status => cluster_gateway_status(GwName)
|
node_status => NodeStatus
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -568,3 +570,14 @@ to_list(B) when is_binary(B) ->
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Internal funcs
|
%% Internal funcs
|
||||||
|
sum_cluster_connections(List) ->
|
||||||
|
sum_cluster_connections(List, 0, 0).
|
||||||
|
|
||||||
|
sum_cluster_connections(
|
||||||
|
[#{max_connections := Max, current_connections := Current} | T], MaxAcc, CurrAcc
|
||||||
|
) ->
|
||||||
|
sum_cluster_connections(T, MaxAcc + Max, Current + CurrAcc);
|
||||||
|
sum_cluster_connections([_ | T], MaxAcc, CurrAcc) ->
|
||||||
|
sum_cluster_connections(T, MaxAcc, CurrAcc);
|
||||||
|
sum_cluster_connections([], MaxAcc, CurrAcc) ->
|
||||||
|
{MaxAcc, CurrAcc}.
|
||||||
|
|
Loading…
Reference in New Issue